Repository navigation
fix(bots): send every answer when the last open question is answered - #51361
Conversation
|
Review status: clean on Problem: on a bot item card with several questions, answering the last one by typing and pressing Enter saved that answer, but then left focus in an empty comment box where Enter did nothing. You had to find and click Send. User-facing change: the answer that fills the last open question, whether a quick reply or the comment box's Enter, now sends every answer at once. The chat question card and the phone already work this way. What the card shows is what gets sent. A question folded with a check counts as answered. The question shown open to change, or one with unsent words in the comment box, waits for its new answer. A partial set never sends by itself, and Send still sends one on purpose. Fixed during review: an old answer could slip out in four ways. (1) Reopening a question and drafting a replacement, then answering the last question; this also failed after a remount, or after reopening another question. (2) Re-picking a reopened question's same reply left a complete set unsent. (3) Enter on another question cleared a reopened question's hold. (4) A reply pick ignored unsent words in the box for that same question. Each case has a test that fails without its fix. Settled by agreement: two further cases, where the old answer is already back on screen folded with a check before the send, are intended under the rule above. An independent reviewer confirmed this. Deferred: none. Verified: unit tests, typecheck, lint and format pass on Linux on this head. Before/after component screenshots of a typed and a picked last answer are in the PR body. The perf screen found nothing: each click or Enter checks at most the questions on one card. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
When a bot asks you several questions at once, you answer each one on its card. Before, answering the last question only saved that answer; you then had to find and click Send, and if you had typed the last answer and pressed Enter, a second Enter did nothing. Now, answering the last open question sends all your answers right away, the same way the chat question card and the phone already do.
What Changed
useBotItemQuestionSteps(desktop) now routes both a pick and the box's answer through oneholdOrSendstep that holds the answer, then posts all answers when every open line has a settled one. This is what the phone's own steps hook already did.Why
The chat question card submits when its last question is answered, and the phone's bot item card posts when the last line is answered. The desktop bot item card was the only one that needed an extra Send, and with typed answers the keyboard got stuck. Matching one pattern across chat, phone and desktop means Enter always finishes the job. The alternative, keeping Send as a required last step and making Enter in an empty box press it, would leave the desktop card behaving differently from the other two.
Linked Issue
Internal UX fix; no issue.
Visual Proof
Three questions already answered; the last one answered by typing and pressing Enter (top), or by picking a quick reply (bottom). Before, the card stops at Send and a second Enter in the empty box does nothing; after, everything sends at once.
Testing
use-bot-item-question-steps.test.tsx: the ask now has three questions so partial sets stay held. New cases: filling the last open line by a pick or by the box's Enter posts every answer once with nothing skipped; a line shown open to change, or with words started in the box naming it, holds the set until its new answer (the box's link to its line survives a remount; a chip pick doesn't use up those words); picking a reopened line's own reply again lets the set post; the box's Enter on another line keeps a reopened line waiting.Several-questions fixtures updated so their flows end the new way; the before/after shots above come from component fixtures rendered on Linux, on
mainand on this branch.Unit tests, typecheck, lint and format ran on Linux.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None, because the only new work is one check over the open lines when an answer is held, which happens once per click or Enter.
Risk
The riskiest part is sending sooner than before: someone who used to answer every question and then reread before pressing Send now sends on the last answer. Partial sets, typed drafts and held answers behave as before, and a refused send keeps its answers to recover. No saved data or protocol changes; the phone and older paired clients are unaffected. Back out with a plain revert.
Level: Low
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Renderer-only change; no platform, SSH or path impact. Mobile already behaves this way.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)