diff --git a/src/components/insights/derived/vitals-dashboard.tsx b/src/components/insights/derived/vitals-dashboard.tsx index 409f62977..1710af3df 100644 --- a/src/components/insights/derived/vitals-dashboard.tsx +++ b/src/components/insights/derived/vitals-dashboard.tsx @@ -105,7 +105,7 @@ interface DashboardProps { batch: DashboardDerived; /** * v1.15.11 W2c — the resolved insights layout, passed down from the page - * (which already mounts `useInsightsLayout()`) so this grid honours the + * (which already mounts `useInsightsLayoutQuery()`) so this grid honours the * user's per-tile order + visibility without a second fetch. Each grid tile * maps to a layout tile id (see `VITAL_TILE_LAYOUT_ID` / * `MOBILITY_TILE_LAYOUT_ID`); a tile the layout marks `visible: false` does diff --git a/src/hooks/use-insights-layout.ts b/src/hooks/use-insights-layout.ts index ba16f02a8..707092c7f 100644 --- a/src/hooks/use-insights-layout.ts +++ b/src/hooks/use-insights-layout.ts @@ -10,33 +10,27 @@ import { } from "@/lib/insights-layout"; /** - * v1.15.11 W2 — the resolved insights overview layout (sections + tiles). + * v1.15.11 — the resolved insights overview layout (sections + tiles) plus the + * query load status. * * Reads `GET /api/insights/layout` through the centralised query-key factory * (`queryKeys.insightsLayout()` → `["user","insightsLayout"]`), the same key - * the W3 PUT mutation invalidates on save so the overview repaints in - * lockstep with the Settings / inline-edit surfaces. The response is already - * the server-resolved v2 layout; we pass it back through - * `resolveInsightsLayout` defensively so a partial / legacy blob from a stale - * cache still normalises to a valid `InsightsLayout`. + * the inline-edit PUT mutation invalidates on save so the overview repaints in + * lockstep with the edit surface. The response is already the server-resolved + * v2 layout; we pass it back through `resolveInsightsLayout` defensively so a + * partial / legacy blob from a stale cache still normalises to a valid + * `InsightsLayout`. * * Returns `DEFAULT_INSIGHTS_LAYOUT` while the query is in-flight so the page * renders in the default section + tile order on first paint — no layout * flicker, no empty state, no "everything hidden" flash before the saved * layout lands. - */ -export function useInsightsLayout(enabled: boolean): InsightsLayout { - return useInsightsLayoutQuery(enabled).layout; -} - -/** - * v1.15.11 QA L1 — same query as {@link useInsightsLayout} but also surfaces - * the load status so a caller can gate a write surface (the inline "Anpassen" - * edit mode) until the GET has settled. Without this gate a user who enters - * edit mode while the layout is still in-flight would seed the editor from + * + * `isLoading` lets a caller gate a write surface (the inline "Anpassen" edit + * mode) until the GET has settled: without that gate a user who enters edit + * mode while the layout is still in-flight would seed the editor from * `DEFAULT_INSIGHTS_LAYOUT` and a "Fertig" save would PUT defaults over their - * real saved layout. Shares the query key, so mounting both hooks costs one - * request (TanStack dedupes). + * real saved layout. */ export function useInsightsLayoutQuery(enabled: boolean): { layout: InsightsLayout;