Skip to content

fix(site): prevent layout shift when agent chat right panel loads - #22983

Merged
DanielleMaywood merged 6 commits into
mainfrom
fix/agent-chat-right-panel-layout-shift
Mar 12, 2026
Merged

DanielleMaywood merged 6 commits into
mainfrom
fix/agent-chat-right-panel-layout-shift

Conversation

@DanielleMaywood

Copy link
Copy Markdown
Collaborator

Problem

The agent chat loading skeleton rendered as a single full-width column without reserving space for the right panel. When chat data loaded and the right panel appeared (based on localStorage state), the layout shifted horizontally.

Fix

Ensure all three skeleton/loading layers reserve the same horizontal space for the right panel:

  1. AgentDetailSkeleton (Suspense fallback for lazy chunk): Reads agents.right-panel-open and agents.right-panel-width from localStorage directly and renders a placeholder div matching RightPanel's sizing CSS.

  2. AgentDetailLoadingView (chat query loading): Receives showRightPanel prop from parent and renders an actual <RightPanel> with skeleton content inside.

  3. AgentDetailView (loaded): Receives showSidebarPanel / onSetShowSidebarPanel props from parent instead of managing the state internally.

Refactors

  • Lifted right panel state to AgentDetail so loading and loaded views share the same layout without duplicating localStorage reads.
  • Moved RIGHT_PANEL_OPEN_KEY from AgentDetailView.tsx to AgentDetail.tsx, co-locating it with its only consumer.

The agent chat loading skeleton rendered as a single full-width column
without reserving space for the right panel. When chat data loaded and
the right panel appeared (based on localStorage state), the layout
shifted horizontally.

Fix this at all three skeleton layers:

1. AgentDetailSkeleton (Suspense fallback): reads panel open/width
   state from localStorage directly and renders a placeholder div
   matching RightPanel's sizing CSS.

2. AgentDetailLoadingView (chat query loading): receives
   showRightPanel prop from parent and renders an actual RightPanel
   with skeleton content inside.

3. AgentDetailView (loaded): receives showSidebarPanel and
   onSetShowSidebarPanel props from parent instead of managing the
   state internally.

The right panel open/closed state is lifted to AgentDetail so the
loading and loaded views share the same layout, and
RIGHT_PANEL_OPEN_KEY is co-located with its only consumer.
…eton

The chat conversation skeleton and right panel skeleton markup was
duplicated identically between AgentDetailSkeleton (Suspense
fallback) and AgentDetailLoadingView (query loading state).

Extract both into shared exported components in AgentsSkeletons.tsx
and import them from AgentDetailView.tsx, eliminating the
duplication.
The original AgentDetailLoadingView had h-full on its single wrapper
div. When we split it into outer (flex-row for right panel) and
inner (flex-col) divs, h-full was dropped. Without it the
flex-col-reverse chat area has no full-height context, causing the
skeleton to float up instead of anchoring at the bottom.
The outer wrapper also needs h-full so it fills the parent height.
Without it, flex-1 alone has no effect when the parent isn't a flex
container (e.g. in Storybook), causing the flex-col-reverse chat
area to collapse and the skeleton to shift upward.
Same issue as AgentDetailLoadingView — splitting the original single
div into outer + inner wrappers dropped h-full from both, causing
the flex-col-reverse chat area to lose its full-height context and
shift the skeleton upward.
@DanielleMaywood
DanielleMaywood marked this pull request as ready for review March 12, 2026 13:06
@DanielleMaywood
DanielleMaywood merged commit 3aada03 into main Mar 12, 2026
26 of 28 checks passed
@DanielleMaywood
DanielleMaywood deleted the fix/agent-chat-right-panel-layout-shift branch March 12, 2026 14:09
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants