Skip to content

fix: update comments in place, and keep the overlay's list after deleting a post - #1777

Merged
mattwoberts merged 2 commits into
mainfrom
fix/comment-no-reload
Nov 18, 2026
Merged

mattwoberts merged 2 commits into
mainfrom
fix/comment-no-reload

Conversation

@mattwoberts

@mattwoberts mattwoberts commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Since the SPA navigation change (#1773), posting a comment calls navigator.reload(). Editing, deleting, approving and declining a comment do the same. navigator.reload() refetches the page payload and remounts the page, so:

  • the view jumps to the top of the page
  • when the post is open as an overlay from Home or the Roadmap, the list is replaced by the full post page, and "Back to all suggestions" disappears

Fix

Comment mutations now update in place:

  • PostDetails gets a refreshComments() that refetches the comments and calls onDataChanged so the list behind the overlay stays current. It is passed to CommentInput (onCommentAdded) and ShowComment (onChanged).
  • CommentInput clears its editor by remounting it with a new key, and shows the "awaiting moderation" toast directly. The COMMENT_CREATED_MODERATION session flag only existed to survive the reload, so it is removed.
  • Approving a post refreshes in place instead of reloading after 1.5s.
  • DiscussionPanel.tsx was not imported anywhere and is deleted.
  • Deleting or declining a post opened as an overlay now closes the overlay and removes the post from the list it came from. Before, it always went to Home, so deleting from the Roadmap left the Roadmap. PostDetails takes an onPostRemoved callback for this. The standalone post page still goes home. Declining no longer waits 1.5s first.

Testing

  • make lint and make test pass.
  • Checked in the browser, with the post opened as an overlay from Home: post, edit and delete keep the overlay, the scroll position and the back link. The editor clears and the comment count updates.
  • Deleted a post from the Roadmap overlay: stayed on /roadmap and the post left the list. Same from the Home overlay on /. Deleting from a directly opened /posts/N page still goes home.
  • Not clicked through: the moderation toast, approving or declining a comment, and declining a post.

🤖 Generated with Claude Code

mattwoberts and others added 2 commits November 18, 2026 14:29
Posting, editing, deleting, approving or declining a comment called
navigator.reload(). That remounted the page and scrolled to the top.
When the post was open as an overlay from Home or the Roadmap, it also
replaced the list with the full post page, so "Back to all suggestions"
disappeared.

PostDetails now refetches the comments and notifies the parent list.
CommentInput clears its editor by remounting it and shows the
moderation toast directly. Approving a post refreshes in place too.
DiscussionPanel was unused and is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or decline

Deleting or declining a post always called goHome(). With the post open
as an overlay from the Roadmap, that left the Roadmap for Home.

PostDetails takes an onPostRemoved callback. Home and Roadmap use it to
close the overlay and drop the post from their list. The standalone
post page still goes home. The decline path no longer waits 1.5s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattwoberts mattwoberts changed the title fix(comments): update comments in place instead of reloading the page fix: update comments in place, and keep the overlay's list after deleting a post Nov 18, 2026
@mattwoberts
mattwoberts added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit c11b9d4 Nov 18, 2026
9 of 10 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