-
-
Notifications
You must be signed in to change notification settings - Fork 208
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
When restoring persisted panel layouts, there is currently a client-side layout shift between the server-rendered and hydrated states. This occurs because panel sizes are restored only after the client JS runs, rather than before the initial paint.
Proposal
If flexGrow were moved to a CSS variable, panel sizes could be restored before hydration.
Specifically:
- A small blocking inline script could read persisted panel sizes (from
localStorage). - The script would then set the CSS variable on the root element (e.g.,
--panel-flex-grow). - The
PanelGroupwould render with the correct flex values immediately, preventing visual jumps.
This approach is somewhat similar to how react-wrap-balancer precomputes text balance client-side before hydration to avoid layout shifts.
@bvaughn What's your opinion on this approach?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request