fix(app): recover prompt text from editor dom; route v1 follow-ups to their session directory - #48533
Open
CannonRS wants to merge 3 commits into
Open
fix(app): recover prompt text from editor dom; route v1 follow-ups to their session directory#48533CannonRS wants to merge 3 commits into
CannonRS wants to merge 3 commits into
Conversation
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 #48528
Closes #48529
Type of change
What does this PR do?
Two small fixes in the app's prompt submission path.
Recover text when the store is empty but the DOM editor still holds it (Closes #48528).
createPromptSubmitparsed the prompt from the store-backed state only. When that state is empty but the DOM editor element still contains text (e.g. after a navigation or state reset), the submit saw an empty prompt and returned early, silently discarding the typed message. The fix falls back to parsing the DOM editor element via a newparsePromptInputV2Editorhelper when the store is empty and no images or comments are present, and sends the recovered text.Send v1 follow-up prompts to their session directory (Closes #48529). The V1 compat API's
promptpath always used the directory the client was created with (the project directory), ignoring the session's own directory. The app now passessessionDirectorywhen sending a follow-up draft, and the compat layer routes the prompt to that directory instead.How did you verify your code works?
bun typecheck(tsgo) passes inpackages/appandpackages/session-ui.submit.test.tspasses 9/9, including a new regression test that submits recovered text from a DOM editor element when the store is empty.git diff --checkclean; no unrelated changes.Screenshots / recordings
n/a (non-UI behaviour; recovery happens before the prompt is sent)
Fork
Checklist