Skip to content

fix(site/src/pages/AgentsPage): preserve right panel tab state across switches - #23737

Merged
DanielleMaywood merged 4 commits into
mainfrom
dm/preserve-right-panel-tab-state
Mar 28, 2026
Merged

DanielleMaywood merged 4 commits into
mainfrom
dm/preserve-right-panel-tab-state

Conversation

@DanielleMaywood

Copy link
Copy Markdown
Collaborator

🤖 This PR was written by Coder Agent on behalf of Danielle Maywood 🤖

Switching between the Git and Desktop tabs in the right panel unmounted the inactive tab, destroying scroll position, expanded file sections, commit message drafts, and tearing down the Desktop VNC connection.

Now all tab panels stay mounted. Inactive ones are hidden with display: none (Tailwind hidden) + inert to block focus/interaction. The Desktop panel's existing ResizeObserver already handles canvas rescaling after display: none, so the VNC stream stays alive with no reconnection flicker.

Design notes

We considered React 19.2's <Activity> component, which would clean up effects on hidden panels. This is normally desirable, but the Desktop panel holds a VNC WebSocket — <Activity> would tear it down on every tab switch and force a visible reconnection cycle. The simpler CSS approach keeps the connection alive, which matches the existing code's intent (the ResizeObserver workaround in useDesktopConnection was already designed for display: none ancestors).

…tches

Render all tab panels simultaneously in SidebarTabView, hiding inactive
ones with `display: none` (Tailwind's `hidden`) plus `inert` to block
focus. Previously only the active tab's content was in the DOM; switching
between Git and Desktop unmounted the inactive panel, losing scroll
position, expanded file sections, commit message drafts, and tearing
down the Desktop VNC connection.

The VNC connection in DesktopPanel already has a ResizeObserver that
handles canvas rescaling after `display: none`, so the Desktop stream
stays alive across tab switches with no reconnection flicker.
@github-actions github-actions Bot added the community Pull Requests and issues created by the community. label Mar 27, 2026
React 19's types already declare inert as boolean.
Merge the desktop panel into the allPanels array instead of
special-casing it separately.
@DanielleMaywood DanielleMaywood changed the title fix(site/pages/AgentsPage): preserve right panel tab state across switches fix(site/src/pages/AgentsPage): preserve right panel tab state across switches Mar 27, 2026
@DanielleMaywood
DanielleMaywood marked this pull request as ready for review March 27, 2026 23:58

@kylecarbs kylecarbs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERY good change

@DanielleMaywood
DanielleMaywood merged commit 399080e into main Mar 28, 2026
35 of 36 checks passed
@DanielleMaywood
DanielleMaywood deleted the dm/preserve-right-panel-tab-state branch March 28, 2026 00:00
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community Pull Requests and issues created by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants