Repository navigation
Mount secondary panel content once on a thread switch - #7803
Merged
Merged
Conversation
This was referenced Nov 19, 2026
Wait for fixed-tab readiness only before the first split surface for a thread. A later readiness drop (plugin reconcile, server plugins starting) no longer swaps the panel for the skeleton and remounts its content; the split container already restores tabs that leave and come back. Co-Authored-By: Claude Opus 5.5 <[email protected]>
After get-bb#7878 a thread's tab readiness also waits for its saved thread tabs to load, so holding the split surface behind a skeleton showed a blank panel for a network round trip on a first visit. Mount the split container immediately instead. When it mounts before the tab list is ready with a saved layout, it renders a best-effort layout, skips persistence, and restores the saved layout once the list is ready. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Human comments
What was wrong
ThreadSecondaryPanelonly mountedSidebarSplitContaineronce the thread's fixed tabs were ready (areFixedTabsReady). Until then it rendered the flat panel surface. On a thread switch, readiness is false on the first render: plugin tabs report visibility from layout effects, and since #7878 a thread also waits for its saved thread tabs (useThreadTabs) to load. When readiness arrived, the panel replaced the flat surface with the split container, and React mounted all panel content a second time. The same swap ran whenever readiness dropped mid-session, for example while a plugin that owns a saved tab reloads. The gate came from #6013. It keeps a saved split layout from being parsed, and overwritten, against an incomplete tab list.What changed
ThreadSecondaryPanelmountsSidebarSplitContainerright away and passes readiness down asisTabListReady. There is no flat-to-split swap, so content mounts once on a switch and stays mounted through plugin reloads.SidebarSplitContainer(new requiredisTabListReadyprop): if it mounts before the tab list is ready and a saved layout exists, it renders a best-effort layout from the available tabs, skips persistence so the saved value stays intact, and restores the saved layout once the list is ready. With no saved layout it uses the deterministic default layout, so nothing remounts when tabs arrive.SecondaryPanelContentSkeleton. After Gate plugin surfaces on the plugin they need, not on every bundle #7878 that skeleton painted for one thread-tabs fetch on every first visit to a thread: 33 ms locally and 333 ms with 150 ms of added latency, with no tab bar or close button.How you verified
ThreadSecondaryPanel.threadSwitch.test.tsxuses the realuseThreadFixedTabs, a real plugin tab registration and a stubbedsdk.threads.tabs.get. Content mounts once per switch for Info and an open file. Content stays mounted with no skeleton while a saved tab's owning plugin reloads, for Info, an open file and a plugin tab. These five tests fail with main'sThreadSecondaryPanel.tsxandSidebarSplitContainer.tsx(expected [ 'info:thr_b', 'info:thr_b' ] to deeply equal [ 'info:thr_b' ]). Further tests check that panel content shows while saved tabs load and that a reloaded plugin tab stays selected.ThreadSecondaryPanel.collapseControl.test.tsxpasses: the stored split survives while visibility resolves and is restored afterwards. It now seeds the thread'slastUsedAt, because the container mounts earlier andpruneSidebarSplitStoragedrops splits for threads without one.pnpm exec turbo run typecheck lint --filter=@bb/apppasses. Thesecondary-panel/,plugin/andthread-detail/suites pass, apart from two failures unrelated to this change: a lazy-loading test that times out under load and passes alone, and abranding.icontest that reads leftover untracked plugin directories in this checkout.pnpm start:worktree:Related: #7801. With that change, the duplicate mount opened one extra short-lived terminal socket per thread switch.
Fixes #7802