jobs: wait for persisted layout before mounting the panel group
ResizablePanel reads defaultSize only at mount, so mounting during the dashboard-state query's loading window froze the fallback sizes and ignored the persisted layout that arrives after — layout survived in-app nav (query cached) but not a full refresh. Gate the render on isLoaded so the group mounts once, with the stored sizes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -330,8 +330,12 @@ const matchesPanelSet = (node: LayoutNode): boolean => {
|
||||
|
||||
// One page for /jobs and /jobs/:id — master (list) + detail, resizable like /chat. The layout is
|
||||
// persisted per-user via useDashboardState (screens/ namespace), so pane sizes survive reloads.
|
||||
// Wait for isLoaded before mounting: ResizablePanel reads defaultSize only at mount, so mounting
|
||||
// during the query's loading window would freeze the fallback sizes and ignore the persisted layout
|
||||
// that arrives after (the "survives nav but not refresh" bug — on nav the query is already cached).
|
||||
export const JobsPage = () => {
|
||||
const { value, setValue } = useDashboardState<LayoutNode>('screens/jobs', JOBS_LAYOUT);
|
||||
const { value, setValue, isLoaded } = useDashboardState<LayoutNode>('screens/jobs', JOBS_LAYOUT);
|
||||
if (!isLoaded) return <div className="h-full w-full" />;
|
||||
const layout = matchesPanelSet(value) ? value : JOBS_LAYOUT;
|
||||
return (
|
||||
<div className="h-full w-full">
|
||||
|
||||
Reference in New Issue
Block a user