Skip to content

fix(composer): show the autosave copy, and drop a posted draft - #279

Merged
jouwdan merged 2 commits into
mainfrom
claude/meith-github-issues-39t98h-275
Aug 27, 2026
Merged

fix(composer): show the autosave copy, and drop a posted draft#279
jouwdan merged 2 commits into
mainfrom
claude/meith-github-issues-39t98h-275

Conversation

@jouwdan

@jouwdan jouwdan commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Closes #275

Two composer draft fixes.

1. Autosave strings rendered as raw keys

ComposerRecovery is one island rendered by both composers. It reads six keys from its copy prop — composer.autosave.saving/saved/failed and composer.recovery.available/restore/discard. replyFormCopy() built all six; newThreadFormCopy() built none, so the moment a new thread autosaved, the page printed composer.autosave.saved verbatim under the message box. pnpm i18n:check couldn't catch it: the catalog carries the messages, the page just never asked for them.

  • apps/community/src/view/content-copy.ts — the six keys are one shared list now, spread into both records so they can't diverge.
  • apps/community/src/view/content-copy.test.ts — scans the composer components for every fromCopy(copy, …) they read and asserts the record a page hands them carries each key and resolves it to prose. Fails without the fix.

2. A posted draft was offered on the next thread

Posting cleared the server draft, but two paths put it back, so starting another thread in the same forum offered the one just posted:

  • A Server Action's redirect is a client-side navigation with JS on, so the browser's recovery copy in localStorage was never removed on a successful post — pagehide doesn't fire.
  • The blur that pressing Post fires raced an autosave in behind the action's own drafts.remove, recreating the server draft after it had gone.

apps/community/src/components/content/composer-recovery.tsx now removes the browser copy when the composer unmounts mid-submit, and a capture-phase pointerdown on any submit button holds off the blur autosave until the next keystroke — so the post's draft removal is the last word. Typing after a failed submit clears the hold, so an errored attempt keeps its draft.

e2e/composer-drafts.spec.ts covers it: autosave a thread, post it, and the next new-thread page is empty with no recovery offer and no localStorage copy left.

docs/guides/community/formatting.md gains a Drafts section describing the feature and this behaviour.

Validation

pnpm lint, pnpm typecheck:app, pnpm i18n:check, pnpm docs:links:check, pnpm docs:index:check, pnpm comments:check, the content-copy unit test, and the new e2e all pass.

claude added 2 commits August 27, 2026 14:12
The new-thread page built its copy record without the six keys
ComposerRecovery reads, so the island rendered them as themselves —
"composer.autosave.saved" under the message box the moment a draft
saved. The reply form's record carried them; the new-thread form's
never had.

Both records share one list now, and a test scans the composer
components for the keys they read from the prop so a record cannot fall
behind one again.

Closes #275

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZGWFg83tyN4hSR3wsPLhF
… thread

Posting cleared the server draft but two paths put it back, so starting
another thread in the forum offered the one just posted. A Server
Action's redirect is a client-side navigation when scripting is on, so
the browser's own recovery copy was never removed on the one path that
mattered; and the blur that pressing Post fires raced an autosave in
behind the action's own draft removal, recreating the server draft after
it had gone.

The browser copy is now removed when the composer unmounts mid-submit —
what a successful post looks like from the browser — and a pointerdown on
any submit button holds off the blur autosave until the next keystroke,
so the post's draft removal is the last word. Typing after a failed
submit clears the hold, so an attempt that errored still keeps its draft.

Refs #275

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZGWFg83tyN4hSR3wsPLhF
@jouwdan
jouwdan force-pushed the claude/meith-github-issues-39t98h-275 branch from a2e306a to 8499758 Compare August 27, 2026 14:13
@jouwdan jouwdan changed the title fix(composer): give the new-thread form the autosave copy it reads fix(composer): show the autosave copy, and drop a posted draft Aug 27, 2026
@jouwdan
jouwdan merged commit c2b3c34 into main Aug 27, 2026
15 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.

composer strings missing translations

2 participants