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:
Marc-André Bombeck committed 2026-06-20 16:51:18 +02:00
1 parent 0623316c12
commit 649bfb3ea8
3 files changed
+30 -2

No files matched your search

+7 -2
View File
@@ -302,7 +302,7 @@ function BriefingSkeleton() {
return (
<div
data-slot="daily-briefing-skeleton"
className="space-y-4 motion-reduce:animate-none"
className="space-y-3 motion-reduce:animate-none"
aria-hidden="true"
>
<div className="space-y-2">
@@ -367,7 +367,12 @@ export function DailyBriefing({
<BriefingSkeleton />
</>
) : briefing ? (
<div className="space-y-4">
// v1.18.10 — body block rhythm matches the sibling insights cards
// (`correlation-card` uses `space-y-3` between its chart /
// interpretation / source blocks). The briefing card carried a
// looser `space-y-4`, which read as taller than its neighbours on
// the overview. One token, no new spacing scale.
<div className="space-y-3">
{/* v1.4.27 B1 — the leading narrative paragraph dropped.
The hero strip subtitle on `/insights` already renders
the same `briefing.paragraph` text directly above this
@@ -330,6 +330,15 @@ export function useInsightsAdvisorQuery(
// their query subtree so the per-section text below the advisor card
// re-fetches.
queryClient.invalidateQueries({ queryKey: queryKeys.insightsRoot() });
// v1.18.10 — the dashboard hero surfaces the briefing headline from the
// SNAPSHOT (server-lifted `User.insightsCachedText`), not from this
// advisor cache. A regenerate rewrites that server cache, so invalidate
// the snapshot too — otherwise returning to the Startseite shows the
// previous briefing under the greeting until the snapshot's own stale
// window lapses. Closes "the briefing doesn't update" on the dashboard.
queryClient.invalidateQueries({
queryKey: queryKeys.dashboardSnapshot(),
});
},
});
@@ -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"));
},