fix(tui): keep closed tabs closed - #40181
Closed
kitlangton wants to merge 1 commit into
Closed
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 tab closed when another TUI process is still viewing the same session.
Before / After
Before: session tabs use shared persisted state. Closing the active tab in one TUI removed it and navigated that TUI away, but another TUI whose route still pointed at the same session observed the removal. Its route-sync effect treated the missing tab as new and appended it again, so the closed tab reappeared at the end of the strip.
After: a missing tab is opened only when that TUI actually enters the session route, enables tabs, or changes tab scope. Reactive title, unread, root-hydration, and shared-storage updates can update an existing tab but cannot resurrect a removed one. Explicitly navigating away and back still opens the session again.
How
packages/tui/src/context/session-tabs.tsxseparates route admission from metadata reconciliation with Solid'sonhelper.packages/tui/test/context/session-tabs.test.tsxruns two TUI providers against the same persisted state and verifies close, non-resurrection, and explicit reopen behavior.Scope
Testing
bun run test test/context/session-tabs.test.tsx test/context/session-tabs-model.test.tsfrompackages/tui(34 passed)bun typecheckfrompackages/tuibun run testfrompackages/tui(592 passed, 5 skipped)git diff --checkThe full suite emits the existing asynchronous session-tab lock teardown warning and completes with zero failures.
Flow