fix(mobile): show the composer draft after answering a question #14058
main fromrefs/pull/14058/head·opened View on GitHubWhat Changed#
After an ask-question card closes, the composer shows the follow-up already stored for that thread. Opening or closing the card does not clear the draft.
The composer stays mounted while the card has the slot. When the card closes, the editor remounts and paints that stored draft. A fresh editor does not treat the draft as a native echo, which is what left the text view empty.
The same rebind runs when a failed-creation card gives the slot back, because that card hides the composer the same way.
Why#
Fixes #14053
The question card hides the composer with display: none so the draft is kept. That also keeps the last keystroke classified as a native echo. When the card closes, iOS drops that echo if the text view no longer matches, so the composer looks empty until a thread switch mounts a new editor.
Checklist#
- This PR is small and focused
- I explained what changed and why
- No UI screenshots. The report is iPad-only, and this environment has no simulator.
apps/mobile/src/native/composerEditorRevision.test.tscovers the rebind.
Grok 4.7 in Cursor.
Summary by CodeRabbit#
- Bug Fixes
- Draft text and editor state are preserved while the composer is hidden by a pending question card or a thread-creation failure, and are available again when the composer returns.
- Opening or keeping a question card open no longer unnecessarily resets the composer, so drafts remain available throughout the interaction.
- When the composer is already visible, its draft remains unchanged.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
e7133797-3c0f-466e-ba88-47424afd74d2📥 Commits
Reviewing files that changed from the base of the PR and between 52e01cf6f9a5bf1a3b12bdf055fde714407c7c5c and 130d1b636cb483599f2e838a2bf6dc212949f553.
📒 Files selected for processing (5)
apps/mobile/src/features/threads/ThreadComposer.tsxapps/mobile/src/features/threads/ThreadDetailScreen.tsxapps/mobile/src/native/composerEditorRevision.test.tsapps/mobile/src/native/composerEditorRevision.tsapps/mobile/src/native/useComposerDraftRebind.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/mobile/src/features/threads/ThreadDetailScreen.tsx
- apps/mobile/src/native/composerEditorRevision.ts
- apps/mobile/src/features/threads/ThreadComposer.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
📝 Walkthrough
Walkthrough#
The mobile thread composer now tracks concealment transitions. When a concealed composer becomes visible, it increments a generation that keys the editor and causes it to remount. ThreadDetailScreen passes the concealment state for active user-input requests and failed thread creation.
Changes#
Composer draft restoration
Layer / File(s) Summary Draft rebind state and transitions
apps/mobile/src/native/composerEditorRevision.ts,apps/mobile/src/native/useComposerDraftRebind.ts,apps/mobile/src/native/composerEditorRevision.test.tsA state transition and hook track composer concealment. Tests cover generation changes and editor event resolution. Composer visibility and editor remount
apps/mobile/src/features/threads/ThreadDetailScreen.tsx,apps/mobile/src/features/threads/ThreadComposer.tsxThreadDetailScreen computes and passes the concealment state while keeping the composer mounted. ThreadComposer keys ComposerEditor by the rebind generation. Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Bug fix · Severity of issue fixed: Medium
Merge Risk: ⚪ Minimal · up to
130d1The composer draft-rebinding change is mergeable after normal checks; no actionable issue remains in the reviewed change.
Security Architecture Review#
Security architecture risk: 🔵 Low · up to
130d1The change refreshes the mobile editor from an existing saved draft when a question or failed-creation card closes. No new messaging authority or external access was identified. Rapid transitions between threads remain less well established, so the risk is low rather than negligible.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
- inferred — The identified production effect is confined to the mobile composer’s local draft display and editor lifecycle; the changed test declarations do not add an attacker-callable entrypoint.
Trust Boundaries and Controls
- observed — A question or failed-creation card conceals the composer with display:none rather than clearing its draft. The new transition responds to that visibility change; it does not add a send path or authorization decision.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation Title check ✅ Passed The title clearly and concisely describes the main fix: restoring the composer draft after answering a question. Description check ✅ Passed The description explains what changed, why the fix is needed, and how the behavior is tested. The checklist is complete for the reported iPad-only UI issue, although the UI Changes section is not incl… Linked Issues check ✅ Passed The PR meets issue [ #14053].ThreadDetailScreenkeepsThreadComposermounted while the question card or failed-creation card owns the composer slot.useComposerDraftRebindincrements the editor …Out of Scope Changes check ✅ Passed The changed files directly support issue [ #14053]. They implement concealment state, draft rebinding, composer integration, and automated tests. The failed-creation-card case uses the same composer-sl…Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 5 files. ✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
Comment `@coderabbitai help` to get the list of available commands.github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
macodev00(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Approvability#
Verdict: Approved at
52e01cfMacroscope's review found this PR approvable — This is a small, focused mobile bug fix that restores an existing composer draft after a question or failed-creation card releases the composer slot. The new remount behavior is narrowly scoped, preserves existing paths, and is covered by targeted state-transition tests.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).