Surface unsent drafts in the sidebar - #131
Merged
Merged
Conversation
Typing into a new-thread composer and navigating away used to strand the draft: it survived in the store but nothing pointed back to it, and the next "new thread" could repurpose or garbage-collect it. Now every draft with real user content (typed text, attachments, or context chips) gets a compact row at the top of the sidebar — project name over the first line of the prompt — that navigates back to /draft/$draftId with everything intact. New-thread surfaces only ever reuse untouched drafts; an invested draft stays parked in the sidebar and a fresh one is minted beside it. Discarding a row asks for confirmation, matching the prompt stash. Store changes: composerDraftHasUserContent gates remap GC and persistence (invested sessions survive unmapped, zombie sessions drop with their composer blobs), clearProjectDraftThreadId sweeps a project's unmapped sessions too, and getDraftSessionByProjectRef prefers the mapped draft.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The empty-state gate counted every invested draft session, including the open never-left one — which renders no row — so typing a first draft made "No threads yet" vanish with nothing replacing it. The frozen open-draft row now lives in a sidebar-owned hook and feeds both the block and the count, so the two can never disagree: the open draft counts only when its frozen snapshot is actually rendered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Typing into a new-thread composer and navigating away used to strand the draft: it survived in the store but nothing pointed back to it, and the next "new thread" could repurpose or garbage-collect it.
What changed
/draft/$draftIdwith composer text, attachments, and workspace context intact. The block vanishes at count 0.composerDraftHasUserContentgates remap GC and persistence — invested sessions survive unmapped, zombie sessions are dropped together with their composer blobs at partialize time;clearProjectDraftThreadIdsweeps a project's unmapped sessions too;getDraftSessionByProjectRefprefers the currently-mapped draft over older unmapped ones.Behavior notes
Testing
vp fmt/vp lint/vp run typecheckclean; full web unit suite (2104 tests) and browser suite (393 tests, incl. 3 new SidebarDrafts cases) green.