fix(tui): stabilize repeated open menu - #42086
Merged
Merged
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.
What
Keep the populated Control-O session/project picker stable when it opens, reopens, or receives the shortcut repeatedly.
Before / After
Before: Opening reset the shared dialog to medium width, mounted a partial picker from local state, then resized it and inserted projects and cross-project recents as two asynchronous requests completed. This produced a visible flash while loading. Pressing Control-O while open also remounted the picker and restarted those requests.
After: Project and recent-session data load before the picker is mounted. Its first visible frame is already populated and large. Repeated Control-O presses leave the active picker mounted, preserving its content, filter, and selection.
How
packages/tui/src/app.tsxloads projects and recent sessions before installing the picker, coalesces concurrent opens, and ignoresopen.menuwhile the picker is active.packages/tui/src/ui/dialog.tsxlets replacements declare their initial size and identity in one batched update.packages/tui/src/component/dialog-open.tsxreceives loaded sessions and no longer fetches or resizes after mounting.packages/tui/test/cli/tui/dialog-open.test.tsxverifies no picker frame appears while recents are pending, then verifies the first picker frame contains both sessions and projects.Scope
This only changes loading, repeated invocation, and initial sizing for the Control-O picker. Other dialogs keep their existing replacement behavior.
Testing
bun typecheckinpackages/tuibun run test test/cli/tui/dialog-open.test.tsx(6 passing, 13 assertions)Demo
Real live-service data, not an isolated fixture. The picker appears fully populated on both opens, and repeated Control-O presses do not remount it.
stable-open-live-2.mp4