fix(tui): preserve session location during handoff - #39886
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 a session's project location available while navigation hydrates its
SessionInfo, so immediately creating a new session starts in the selected project.This follows up on #39753. The inherited-directory behavior worked for hydrated sessions, but the Open menu could navigate with a session fetched privately by the dialog before the shared data context knew about it.
Before / After
Before
SessionInfo.locationand falls back to the launch/default directory.After
LocationProvider.reffrom the dialog'sSessionInfo.LocationProvider.ref.How
packages/tui/src/component/dialog-open.tsxsets the selected session's location without changing stable option identity.packages/tui/src/routes/session/index.tsxkeeps the existing provisional location whileSessionInfois unavailable.packages/tui/src/app.tsxfalls back to the provisional location when creating a new session.packages/tui/test/cli/tui/dialog-open.test.tsxselects a session available only in the dialog's private request and verifies its location is preserved while the shared store remains unhydrated.Scope
This does not add route-level location state, preload fetched Open-menu sessions into the shared data store, or change server synchronization behavior.
Testing
cd packages/tui && bun run test(576 passed, 5 skipped)cd packages/tui && bun typecheckbun turbo typecheck --concurrency=3(33 tasks passed)Flow
sequenceDiagram participant Open as Open dialog participant Location as LocationProvider participant Data as Session data participant New as New Session Open->>Location: set selected SessionInfo.location Open->>Data: navigate before shared hydration alt New Session before hydration New->>Location: inherit provisional ref else SessionInfo hydrated Data-->>New: inherit hydrated location end