fix(session-ui): preserve mentions when the context menu opens - #42547
Open
gold-beyond wants to merge 1 commit into
Open
fix(session-ui): preserve mentions when the context menu opens#42547gold-beyond wants to merge 1 commit into
gold-beyond wants to merge 1 commit into
Conversation
Opening the @ context menu via the plus button rebuilt the draft with setText(promptText + "@"), which drops mention content and moves every mention chip to the end of the prompt. Append "@" at the caret with draft.addText instead, keeping the existing prompt structure intact. Fixes anomalyco#42546
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.
Issue for this PR
Closes #42546
Type of change
What does this PR do?
Opening the
@context menu (the+button → "Context") used to rebuild the draft viasetText(promptText + "@").promptTextonly joinstextparts, so mention content was dropped, andsetTextmoves every non-text part to the end — silently rewriting the draft (e.g.hi @src/index.ts and @src/index.tsbecamehi and @@src/index.ts@src/index.ts).This changes
openContextto emit adraft.addTextcommand instead, which appends@at the caret via the existingaddTextstore action and keeps the prompt structure intact.How did you verify your code works?
context.openemitsdraft.addText(notdraft.setText).andbetween them.bun typecheckinpackages/session-uipasses.bun test src/v2/components/prompt-inputinpackages/session-ui: 17 pass.Screenshots / recordings
This is not a UI change.
Checklist