Keep chat and comment-thread drafts when switching files - #88
Merged
Conversation
Tab switches remounted the editor by flipping docLoaded, which also tore down the agent dock and wiped whatever was in the Chat box. Keep the dock mounted independently, store the draft in session state, and don't dismiss the popover when clicking the workspace. Co-authored-by: ss.shankar505 <ss.shankar505@gmail.com>
shreyashankar
marked this pull request as ready for review
August 25, 2026 23:45
The editor remounts on every tab switch, which wiped unsent replies and collapsed the open gutter thread. Store the draft by thread id and remember which thread was open on each tab so a quick peek at another file restores both. Co-authored-by: ss.shankar505 <ss.shankar505@gmail.com>
Tab and file-tree clicks were treated as outside the gutter, which collapsed the thread before switchTab could remember it. Ignore those clicks, keep the last opened thread id per tab, and flush the reply box on unmount so the draft survives the editor remount. Co-authored-by: ss.shankar505 <ss.shankar505@gmail.com>
GitHub strips HTML video tags unless the file is drag-dropped as an attachment. These GIFs play inline in the description instead. Co-authored-by: ss.shankar505 <ss.shankar505@gmail.com>
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.
Typed chat text was disappearing when switching tabs. There was no existing GitHub issue for it.
Two compose surfaces had the same failure mode (tab switch remounts the editor / used to remount the dock):
Cause
switchTabflipsdocLoadedto remountTiptapEditor. The agent dock was gated on the same flag, so it remounted too and local$state(open + draft) reset.CommentGutterlocal state. Tab clicks also collapsed the open thread (handleOutsideMousedown) beforeswitchTabcould remember it.Fix
AgentDockShellon a one-shotappReadyflag so tab switches no longer tear it down.Videos
Agent Chat draft survives a file switch:
Comment-thread reply survives a tab switch:
Screenshots
Chat draft still open after switching to
chapter-two.md:Same Chat draft after returning to
chapter-one.md:Comment thread reply still present after switching tabs and coming back:
Unsent Chat draft indicator after closing the popover with Escape: