Repository navigation
fix(tui): isolate tab scroll state - #42456
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 each session tab at its own transcript reading position when the
tab_scrollexperiment is enabled.Before / After
Before
scrollTopalso became stale when older transcript rows mounted above the visible tail.After
How
packages/tui/src/routes/session/index.tsxcaptures the mounted session ID instead of reading the advanced route during cleanup.scrollTop, so prepending lazily mounted history does not change the remembered location.packages/tui/src/context/session-tabs.tsxstores per-session bottom offsets and clears them when the experiment is disabled or a tab closes.Scope
tab_scrollexperiment is enabled.Testing
cd packages/tui && bun run test(694 passed, 5 skipped)cd packages/tui && bun typecheckbunx prettier --check src/routes/session/index.tsx src/context/session-tabs.tsxtab_scroll, scrolled one session several pages upward, switched to another tab and back, and confirmed the original transcript region andLatest ↓state were restored without affecting the other tab.Performance
Profiled warm tab switches in a real PTY against the elected V2 server using one warmup and repeated alternating switches. Timings ran from tab selection to the post-layout restored transcript.
Bounded restoration is about 70% faster in the measured scrolled-up case and stays close to the bottom-pinned path. The visible transcript was captured before and after deep restoration and matched exactly apart from the devtools focus marker.
Row reduction averaged about 1.1 ms, so caching reduced rows was rejected as the next optimization: transcript render/layout, not row derivation, dominated this workload. Temporary profiling instrumentation was removed before commit.