Skip to content

fix: keep composer drafts per thread instead of carrying text across switches - #13

Merged
currentbits merged 2 commits into
mainfrom
coder/chat-input-is-not-bound-per-thread-typed-5a15dd
Aug 14, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/chat-input-is-not-bound-per-thread-typed-5a15dd

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Fixes #12.

What changed

ThreadView mounts a single Composer and swaps its threadId prop when you change threads, but the input text was plain useState("") on that one instance — so an unsent draft typed in thread A followed you into thread B.

Drafts now live in a Record<threadId, string> map inside Composer, with value/setValue derived for the current thread (mirroring the existing templateByThread pattern in the same file). Switching to another thread shows that thread's own (or empty) input, and switching back restores the original draft. Sending still clears only the sending thread's draft, even if you switch threads mid-send, since the callback captures its thread id.

Testing

  • New test in test/composer.test.tsx renders one Composer, swaps threadId without remounting (a remount would mask the bug), and asserts thread B starts empty and thread A's draft is restored on return. Red before the fix, green after.
  • Full suite: 709 pass; the one failure (App memory wiring in test/appWiring.test.tsx) also fails on a clean tree, so it's pre-existing. npm run typecheck is clean.

Deliberately not persisted across app restarts — in-memory covers the reported bug.

  • PR created by the Claude Code agent

Willem and others added 2 commits August 14, 2026 15:12
… When we are running a project using orchestration the worker
One Composer instance serves every thread, so plain useState carried
unsent text across a switch. Drafts now live in a map keyed by threadId,
mirroring the existing templateByThread pattern; switching back restores
the thread's own draft.

Fixes #12

Co-Authored-By: Claude Fable 5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit 1d5b055 into main Aug 14, 2026
@currentbits
currentbits deleted the coder/chat-input-is-not-bound-per-thread-typed-5a15dd branch October 3, 2026 16:07
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.

Chat input is not bound per thread — typed draft follows you when switching threads

1 participant