Skip to content

Fixed newly posted replies sometimes not appearing#28198

Merged
kevinansfield merged 1 commit into
TryGhost:mainfrom
kevinansfield:fix-comments-ui-stale-reply-refetch
May 27, 2026
Merged

Fixed newly posted replies sometimes not appearing#28198
kevinansfield merged 1 commit into
TryGhost:mainfrom
kevinansfield:fix-comments-ui-stale-reply-refetch

Conversation

@kevinansfield
Copy link
Copy Markdown
Member

@kevinansfield kevinansfield commented May 27, 2026

Summary

  • preserves the POSTed reply when the immediate replies refetch returns stale data
  • keeps the refetch behavior so concurrent replies are still picked up
  • adds unit coverage for stale and fresh reply refetch responses

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f7545435-d7cd-4564-bd21-59f09d09e871

📥 Commits

Reviewing files that changed from the base of the PR and between 94e9d55 and 3462aad.

📒 Files selected for processing (4)
  • apps/comments-ui/package.json
  • apps/comments-ui/src/actions.ts
  • apps/comments-ui/test/unit/actions.test.js
  • apps/comments-ui/test/utils/mocked-api.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/comments-ui/package.json
  • apps/comments-ui/test/unit/actions.test.js
  • apps/comments-ui/src/actions.ts

Walkthrough

The PR updates the addReply action to handle potentially stale cached replies. After creating a new reply and fetching all parent replies, the action checks whether the newly created reply is already present; if not, it appends the reply and recalculates the parent comment's count.replies from the merged replies. Mocked API helpers now return the created reply deterministically for reply branches, unit tests were added for both deduplication and non-duplication scenarios, and the package version was bumped to 1.5.5.

Suggested reviewers

  • rob-ghost
  • jonatansberg
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fixed newly posted replies sometimes not appearing' clearly and concisely summarizes the main fix addressing stale reply caching issues.
Description check ✅ Passed The description is directly related to the changeset, explaining the fix for stale reply data, retention of refetch behavior, and added test coverage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@kevinansfield kevinansfield requested a review from rob-ghost May 27, 2026 15:37
@kevinansfield kevinansfield force-pushed the fix-comments-ui-stale-reply-refetch branch from 38331fd to 94e9d55 Compare May 27, 2026 15:48
no issue
Caching can serve a stale replies response immediately after creation, so we preserve the POSTed reply while still using the refetch to pick up concurrent replies.
@kevinansfield kevinansfield force-pushed the fix-comments-ui-stale-reply-refetch branch from 94e9d55 to 3462aad Compare May 27, 2026 16:30
@kevinansfield kevinansfield merged commit ab58ff0 into TryGhost:main May 27, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant