GeezerVison is showing github.com — fix(web): discarding a draft from the sidebar asks first by Mnigos · Pull Request #12736 · pingdotgg/t3code
Conversation
Mnigos
commented
Sep 20, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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 composerDraftStore keeps 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 use api.dialogs.confirm.
confirmDiscardDraft in Sidebar.tsx opens the destructive confirm dialog ("Discard draft? The unsent message and its attachments will be removed.").
- Both discard paths await it before touching the store:
handleDiscardDraftClick on thread rows (clearComposerContent) and handleDiscard on 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.md does 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.
| Before: one click, the draft is gone |
After: the click asks first |
 |
 |
 |
 |
Implemented with Claude Code (Claude Fable 5.1).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Approvability
Verdict: Approved at 2457ecc
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:
- Diff unchanged. Approvability was decided on eligibility alone.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Sep 20, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
 
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: f729ee2c-d913-4a37-a45c-3c622dde81fe
📥 Commits
Reviewing files that changed from the base of the PR and between 7445aa7 and 2457ecc.
📒 Files selected for processing (1)
apps/web/src/components/Sidebar.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough
Draft 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.
Changes
Draft discard confirmation
| Layer / File(s) |
Summary |
Confirmation gate apps/web/src/components/Sidebar.tsx |
confirmDiscardDraft checks local API availability and accepts deletion only after an affirmative response. |
Discard action integration apps/web/src/components/Sidebar.tsx |
Draft-block and thread-row discard handlers wait for confirmation before releasing uploads and clearing draft content. |
Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: t3dotgg
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
⚠️ Warning |
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name |
Status |
Explanation |
| Linked Issues check |
✅ Passed |
Issue #12735 requires a guard against accidental loss from both sidebar draft-discard controls. The PR summary states that it adds a destructive “Discard draft?” confirmation dialog, routes both threa… |
| Out of Scope Changes check |
✅ Passed |
The reported change is limited to apps/web/src/components/Sidebar.tsx. The described additions modify draft-discard behavior and upload release timing, which directly address Issue #12735. No unrela… |
| Title check |
✅ Passed |
The title clearly identifies the main change: requiring confirmation before discarding a sidebar draft. |
| Description check |
✅ Passed |
The description explains the problem, the implemented fix, the affected discard paths, and verification results. It includes UI screenshots and interaction recordings. It does not use the template hea… |
- Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
What do you think about "double-click" on it without modal? I don't remember where I've seen this practice, but I found it nice.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note Grok responding on behalf of Julius.
Closing as superseded by #10637. The confirm-dialog approach is no longer needed: discard now uses the sidebar undo notice (discardComposerDraft), which resolves #12735.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
macroscope-review
Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews
size:S
10-29 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|