fix(dashboard): show skeleton instead of default layout until hydration completes
Root cause: useDashboardLayout initialised React state with createDefaultDashboardLayout() (1 widget), so the wrong default rendered during the ~100–500ms window while React Query fetched the user session and DB layout after login. On reload within staleTime the cache hit resolved instantly, masking the bug. Fix: add isHydrated boolean state that becomes true only once localStorage OR DB hydration has settled; DashboardClient renders a GridLayoutSkeleton until then. Also adds router.refresh() in the sign-in handler to bust the Next.js Router Cache so the post-login navigation always lands on a fresh server component tree. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -59,6 +59,9 @@ export default function SignInPage() {
|
||||
setTotp("");
|
||||
}
|
||||
} else {
|
||||
// Invalidate the Next.js Router Cache so (app)/layout.tsx re-renders
|
||||
// with the fresh session, then navigate to the dashboard.
|
||||
router.refresh();
|
||||
router.push("/dashboard");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user