Skip to content

fix: apply only the latest reply request in a thread - #493

Closed
SanderMuller wants to merge 1 commit into
dev-null-sh:productionfrom
SanderMuller:fix/thread-replies-latest-wins
Closed

SanderMuller wants to merge 1 commit into
dev-null-sh:productionfrom
SanderMuller:fix/thread-replies-latest-wins

Conversation

@SanderMuller

@SanderMuller SanderMuller commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

A thread loads replies in three places. They are the first load, reload() after a post, delete or undo, and loadUntil() behind the more-replies button and "Show all". Each one writes its result when it arrives, so an older response can overwrite a newer one. For example, if you post a reply while more replies are still loading, the reload shows your reply. Then the late page replaces the list, and your reply is gone until the next reload. Two quick deletes can bring a deleted reply back the same way.

Each request now takes an id. Only the latest one writes its page to the list and the reply count, and clears isLoading.

ThreadReplies.test.tsx runs useThread with fake fetches that resolve out of order. It covers a late page from the more-replies button and two overlapping reloads, which both fail on production. A third case checks that the button does not stay on "Loading replies…" when the first-load refetch replaces a request still in flight. I added the test to draft-images.config.ts and tests/tsconfig.json, so the gate runs and type-checks it.

I did not reproduce the race in a browser, because it needs two requests in flight at the same time.

#480 adds a line at the same place in draft-images.config.ts, so whichever lands second needs a one-line rebase.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SanderMuller
SanderMuller force-pushed the fix/thread-replies-latest-wins branch from 394f162 to 378df21 Compare October 19, 2026 20:44
@xHeaven

xHeaven commented Oct 26, 2026

Copy link
Copy Markdown
Member

Closing this as already implemented (multiple times).

@xHeaven xHeaven closed this Oct 26, 2026
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.

2 participants