Skip to content

fix(composer): the box was never emptied after a successful post - #812

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/composer-clears
Aug 28, 2026
Merged

fix(composer): the box was never emptied after a successful post#812
github-actions[bot] merged 1 commit into
mainfrom
fix/composer-clears

Conversation

@catomean

Copy link
Copy Markdown
Collaborator

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 ("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 onSuccess straight through again fails the "empties the box" test, and only that one.

🤖 Generated with Claude Code

https://claude.ai/code/session_012dpTLxh5GJWeWTF1UEvcD5

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
@github-actions
github-actions Bot merged commit 8ac582c into main Aug 28, 2026
6 checks passed
@github-actions
github-actions Bot deleted the fix/composer-clears branch August 28, 2026 12:33
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