mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 14:16:12 +00:00
fix(dashboard): refresh briefing and layout on the Startseite without reload
The dashboard hero reads the briefing headline and the layout from the server snapshot. Regenerating a briefing or saving the dashboard layout only touched their own caches, so the snapshot kept stale data until its own window lapsed and the Startseite looked unchanged until a manual reload. Invalidate the dashboard snapshot on briefing regenerate and on layout save/reset. Harmonise the daily-briefing card body rhythm with its sibling insights cards (space-y-3, matching correlation-card) so it no longer reads taller.
This commit is contained in:
1 parent
0623316c12
commit
649bfb3ea8
3 files changed
+30
-2
No files matched your search
@@ -204,6 +204,15 @@ export function DashboardLayoutSection({ id }: { id: string }) {
|
||||
},
|
||||
onSuccess: (saved) => {
|
||||
queryClient.setQueryData(queryKeys.dashboardWidgets(), saved);
|
||||
// v1.18.10 — the Startseite reads its layout (tile/chart visibility,
|
||||
// order, comparison baseline, hero toggle) from the dashboard
|
||||
// SNAPSHOT, not from this `dashboardWidgets` key. Without an
|
||||
// invalidation the snapshot keeps its cached layout and the dashboard
|
||||
// looks stale until a manual reload. Invalidate the snapshot so the
|
||||
// next visit (or open tab) re-reads the saved layout immediately.
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.dashboardSnapshot(),
|
||||
});
|
||||
setDraft(null);
|
||||
toast.success(t("dashboard.layoutSaveSuccess"));
|
||||
},
|
||||
@@ -216,6 +225,11 @@ export function DashboardLayoutSection({ id }: { id: string }) {
|
||||
},
|
||||
onSuccess: (saved) => {
|
||||
queryClient.setQueryData(queryKeys.dashboardWidgets(), saved);
|
||||
// v1.18.10 — same snapshot invalidation as the save path so a reset
|
||||
// to defaults reflects on the Startseite without a manual reload.
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.dashboardSnapshot(),
|
||||
});
|
||||
setDraft(null);
|
||||
toast.success(t("dashboard.layoutResetSuccess"));
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user