fix(composer): the box was never emptied after a successful post - #812
Merged
Conversation
Found while verifying the Ctrl+Enter fix in production. The post was created at 12:18:10 and the composer still held its text afterwards. A successful post calls clearDraft(), which discards the SAVED draft. The function that owns `content` is clearFormState(), and it was reachable only from the offline-queue path and from reset() — neither of which a normal successful post touches. So the text stayed, and pressing post again hit the server's duplicate guard, which reads as the button being broken rather than as having already worked. This affected the button exactly as much as the shortcut. The earlier fix — letting a reset overwrite a focused editor — was necessary and not sufficient: it made the DOM follow a reset that never came. Clearing belongs in the hook that owns the state, not in usePostSubmission, which should not have to know how to empty somebody else's form. A failed post still keeps the text, which is the half worth not breaking. Proven by mutation: passing onSuccess straight through again fails the "empties the box" test and only that one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012dpTLxh5GJWeWTF1UEvcD5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while verifying the Ctrl+Enter fix in production. The post was created at 12:18:10 and the composer still held its text afterwards.
A successful post calls
clearDraft(), which discards the saved draft. The function that ownscontentisclearFormState(), and it was reachable only from the offline-queue path and fromreset()— neither of which a normal successful post touches. So the text stayed, and pressing post again hit the server's duplicate guard ("You just posted this"), which reads as the button being broken rather than as having already worked.This affected the button exactly as much as the keyboard shortcut. The earlier fix in #806 — letting a reset overwrite a focused editor — was necessary and not sufficient: it made the DOM follow a reset that never came.
Clearing belongs in the hook that owns the state, not in
usePostSubmission, which should not have to know how to empty somebody else's form. A failed post still keeps the text, which is the half worth not breaking.Proven by mutation: passing
onSuccessstraight through again fails the "empties the box" test, and only that one.🤖 Generated with Claude Code
https://claude.ai/code/session_012dpTLxh5GJWeWTF1UEvcD5