fix(app): preserve workspace terminals across session routes - #48535
Open
CannonRS wants to merge 1 commit into
Open
fix(app): preserve workspace terminals across session routes#48535CannonRS wants to merge 1 commit into
CannonRS wants to merge 1 commit 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 #48531
Type of change
What does this PR do?
Moves the workspace-terminal cache from route scope to app scope so terminals survive session-route changes.
Previously
TerminalProvider(mounted in the session page) created a per-route cache and disposed all its terminal sessions when the route unmounted. Switching chats in the same workspace directory therefore tore down an open bottom terminal. This PR introduces an app-levelTerminalRegistryProviderthat owns acreateWorkspaceTerminalRegistry(LRU with the sameMAX_TERMINAL_SESSIONSlimit) and makesTerminalProviderresolve its workspace sessions through that registry instead of a route-local map. The draft page also mountsTerminalProviderso a new chat can reopen the same bottom terminal before its first prompt.How did you verify your code works?
bun typecheck(tsgo) passes inpackages/app.terminal.test.tspasses 8/8, including two new tests forcreateWorkspaceTerminalRegistry(reuse across same key, LRU eviction with per-workspace separation).git diff --checkclean; no unrelated changes.Screenshots / recordings
n/a (behaviour fix; no visual change)
Fork
Checklist