Repository navigation
fix(app): list drafts in the inbox sidebar - #65525
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
There was a problem hiding this comment.
The change looks sound. I couldn't run it, because the Inbox sidebar is in the web/desktop app and I can only drive the TUI here. tsc -b in packages/app passes, and the src/shell/titlebar and src/shell/tabs unit tests pass (261/261).
What I checked in the code:
- Shared state: the sidebar reads each draft from the same tab memory key and saved draft prompt that the draft page's composer uses. Rows always match what the draft page shows, and drafts saved in an earlier run are found.
- Discard draft: it goes through
closeTab. Discarding the draft you're on moves you to the next tab, and the draft's saved state is removed. - Empty group: an empty Drafts group is hidden, and the inbox's empty message still accounts for it.
Public API: unchanged.
This is a visible UI change and it hasn't been run in the app yet. Could you add before/after screenshots or a short recording of the Inbox sidebar? Please cover these steps: type in a New session draft, open another session, click New session, reopen the first draft from the Drafts group, then use Discard draft on the draft you're currently on.
Issue for this PR
Closes #
Type of change
What does this PR do?
The Inbox layout's sidebar lists sessions but not tabs, so drafts never show there. If you start a New session, type something, open another session and then click New session again, the draft you were typing in can't be opened from anywhere. Its text is still saved, but you can't get back to it.
This PR adds a Drafts group at the top of the Inbox sidebar. It lists the draft you're on, plus every other draft that still has text, an attachment or a context item, newest first. Each row shows the first line of the draft (or "New session") and its project. Clicking a row opens that draft, and right-clicking gives Discard draft, which closes the draft tab.
Drafts saved in an earlier run are found too: the group loads each draft's composer state from storage (
tabs.state(..., createDraftComposerState)), the same state the draft page uses. New session itself is unchanged and still always opens a new draft, as in the other layouts.This is an alternative to #65518, as the review there suggested. That PR made New session reopen the last draft instead; only one of the two should land.
How did you verify your code works?
bun run typecheckinpackages/appbun testforsrc/shell/titlebarRan the web app locally against a demo server and went through the flow in the screenshots below.
Screenshots / recordings
Recorded in the web app (
packages/appdev server) against a throwaway local server with demo projects, Inbox layout on.Checklist