fix(tui): keep prompt mounted during permission and question modals#21262
Open
kevinWangSheng wants to merge 2 commits intoanomalyco:devfrom
Open
fix(tui): keep prompt mounted during permission and question modals#21262kevinWangSheng wants to merge 2 commits intoanomalyco:devfrom
kevinWangSheng wants to merge 2 commits intoanomalyco:devfrom
Conversation
visible() was gated behind <Show when={visible()}>, so the Prompt component
was unmounted whenever a permission or question request became active.
On dismiss, it remounted fresh, losing any text the user had typed.
The Prompt component already handles visible={false} correctly: it blurs
the input and hides its <box>. Removing the <Show> wrapper lets the Prompt
stay mounted throughout, preserving draft text across modal interactions.
Fixes anomalyco#21120
f3d5e76 to
9b36639
Compare
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 #21120
Type of change
What does this PR do?
The TUI prompt input loses any text typed while the agent is working as soon as a permission or question modal appears.
The root cause is in
tui/routes/session/index.tsx. Thevisible()memo is:When a permission fires,
visible()becomesfalse, and the<Show when={visible()}>wrapper unmounts the entirePromptcomponent. The local state holding the typed text is destroyed. After the modal is dismissed,Promptremounts from scratch with an empty input.The fix removes the
<Show when={visible()}>wrapper. ThePromptcomponent already handlesvisible={false}correctly — it blurs the input and hides its<box visible={props.visible !== false}>— so no separate<Show>guard is needed. Thevisible={visible()}prop is still forwarded to bothTuiPluginRuntime.SlotandPrompt, preserving all existing hide/blur behavior while keeping the component tree (and its typed text) alive across modal interactions.How did you verify your code works?
cd packages/opencode && bun run typecheckpasses cleanlypermissions().length > 0→visible()= false →Prompt's internalcreateEffectblurs the input and<box visible={false}>hides it, whilestore.prompt.inputremains intact. On dismiss,visible()= true → box shows again, input refocuses with the text still present.Screenshots / recordings
N/A
Checklist