Conversation
The hover-only X on a thread row with an unsent draft, and on a new-thread draft row, cleared the prompt and attachments on a single click. It sits on the row's own click target and the draft store keeps no snapshot, so a click meant to open the thread could lose the message for good. Both paths now go through the same destructive confirm dialog that thread delete uses, matching the "Discard draft?" alert on mobile.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This one-file fix adds an existing confirmation-dialog pattern to both sidebar draft-discard paths while preserving the original cleanup behavior after confirmation. Cancellation or dialog failure leaves the draft intact, and no defaults, schemas, infrastructure, or static-analysis settings are changed. Notes:
You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughDraft discard actions in the sidebar now require destructive confirmation. Declined or unavailable confirmation leaves drafts unchanged. Confirmed actions release uploads and clear the relevant draft content. ChangesDraft discard confirmation
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Note 🤖 Claude Fable 5.1 on behalf of Mnigos Nice idea, and lighter than a modal. I kept the confirm dialog here because the triage on #12735 asked for a confirm or an undo toast, and the dialog matches what mobile and thread delete/archive already do. An inline "discard?" second step would be a new pattern in the sidebar (extra state, reset on mouse leave, and a fast accidental double-click still loses the draft), so I would rather leave that call to the maintainers. Happy to switch if they prefer it. |
Dismissing prior approval to re-evaluate 2457ecc

Fixes #12735.
Problem
In the sidebar, a thread row with an unsent draft and a new-thread draft row both show a hover-only X ("Discard draft"). One click wiped the prompt, attachments, and contexts with no confirmation, undo, or toast. The X sits on the row's own click target and
composerDraftStorekeeps no snapshot, so a click meant to open the thread could lose the message for good.Fix
The triage offered a confirm or an undo toast. I went with the confirm, because it matches what already exists: mobile guards the same action with
Alert.alert("Discard draft?", …), and sidebar delete and archive useapi.dialogs.confirm.confirmDiscardDraftinSidebar.tsxopens the destructive confirm dialog ("Discard draft? The unsent message and its attachments will be removed.").handleDiscardDraftClickon thread rows (clearComposerContent) andhandleDiscardon draft rows (clearDraftThread). Uploads are released only after confirming.No new setting: unlike delete and archive, there is no way to get a discarded draft back, so an opt-out did not seem worth it. Moving the X out of the row's click target is left out to keep this to one concern; with the confirm in place a stray click no longer loses anything.
docs/user/thread-sidebar.mddoes not mention the control, so there is nothing to update.Verification
Web typecheck and targeted lint are clean. No unit test: the change routes two click handlers through the existing dialog, and a test would only assert that wiring.
Recorded in a real browser against the dev server, on a new-thread draft row. After: the X opens the dialog, Cancel keeps the draft, Confirm removes it.
Implemented with Claude Code (Claude Fable 5.1).