mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 05:42:19 +00:00
fix(dashboard): pin the Today hero to the skeleton during hydration
The digest query rehydrates from the persisted client cache, so the Today hero was painting on the first client render while the server had rendered the skeleton — a text-content hydration mismatch (React #418) that the dashboard e2e's no-significant-errors gate caught. Gate the hero on `mounted` like the rest of the dashboard's late-hydrating surfaces, so SSR and the first client render both show the skeleton and the hero appears once mounted.
This commit is contained in:
1 parent
0be26473b4
commit
08a3ae2ef1
1 file changed
+6
-1
@@ -793,7 +793,12 @@ export default function DashboardPageClient() {
|
||||
degrades to nothing (the hero itself returns null). The dense
|
||||
tile grid + charts below are untouched. */}
|
||||
{insightsEnabled &&
|
||||
(digestQuery.isLoading ? (
|
||||
// `!mounted` pins the SSR pass AND the first hydration render to the
|
||||
// skeleton (v1.16.4 pattern): the digest query rehydrates from the
|
||||
// persisted cache on the client, so without this gate the client's
|
||||
// first render would paint the hero while the server rendered the
|
||||
// skeleton — a text-content hydration mismatch (React #418).
|
||||
(!mounted || digestQuery.isLoading ? (
|
||||
<TodayHeroSkeleton />
|
||||
) : digestQuery.data ? (
|
||||
<TodayHero digest={digestQuery.data} />
|
||||
|
||||
Reference in new issue
Block a user