Skip to content

fix(web): keep typed text when a question option is clicked - #1

Closed
myfunc wants to merge 1 commit into
mainfrom
fix/keep-typed-answer-on-option-select
Closed

myfunc wants to merge 1 commit into
mainfrom
fix/keep-typed-answer-on-option-select

Conversation

@myfunc

@myfunc myfunc commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

What Changed

Clicking an option in a pending user-input question no longer discards text typed into the composer.

  • pendingUserInput.ts: new pure helper carryDisplacedCustomAnswerIntoPrompt with tests.
  • ChatView.tsx: onSelectActivePendingUserInputOption moves a non-empty custom answer into the thread draft before the option replaces it.
  • ChatComposer.tsx: when the question clears, the shared prompt ref is resynced from the thread draft.

Why

While a question is active the composer edits the question's custom answer. Selecting an option rebuilds that answer with customAnswer: "", because a custom answer outranks selected options. Anything the user typed in the meantime is gone: not in the answer, not in the draft, not in any message. Fixes pingdotgg#12569.

The second change closes a related gap: after the question resolved, the composer showed the thread draft but the prompt ref still held the last answer text, so Send without further typing read the wrong value.

Text moved into the draft comes back in the composer once the question resolves and is sent as the next message, same as text typed before the question arrived. Mobile keeps the answer in its own input on the question card and is not affected.

UI Changes

No visual change. Interaction: type while a question is open, click an option, the text stays in the draft and reappears when the question clears.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (not applicable, no visual change)
  • I included a video for animation/interaction changes (not applicable, behaviour covered by the steps below)

Validation:

  • Before, on a dev build from dfbb11bdd: type while a single-choice question is open, click an option. The composer empties and the text is not in the draft, the answer, or any message.
  • After: same steps. The answer goes out, the typed text is back in the composer, and Send submits it in full as the next message.
  • Unit tests for the helper, typecheck for apps/web, targeted lint with only pre-existing warnings.

Tests cover the new helper only. There is no regression test that fails on main: the drop happens inside the ChatView handler, and a test there costs more than the fix. We chose to skip it on purpose for now, not sure yet whether it would be overengineering for a change this size. Feedback welcome.

lovely composed in pair with Claude Fable 5.1 in Claude Code

Selecting an option for a pending user-input question replaced the custom
answer with an empty string, so anything the user had typed into the
composer while the question was active was discarded. The typed text now
moves into the thread draft and comes back once the question resolves.

The composer also resyncs its shared prompt ref from the thread draft when
the question clears; before, Send read the stale answer text instead of
the draft shown in the editor.

Fixes pingdotgg#12569.

Done with Claude Code, model Claude Fable 5.1.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@myfunc

myfunc commented Sep 19, 2026

Copy link
Copy Markdown
Owner Author

Superseded by pingdotgg#12575.

@myfunc myfunc closed this Sep 19, 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.

[Bug]: Clicking a question option discards text typed into the composer

1 participant