From a0939ec6958eacda372a990b5b97d3e41f4e6e3c Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 29 Nov 2025 02:22:03 -0800 Subject: [PATCH] fix: pass auth data from server to client layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The +layout.ts universal load function was only returning queryClient and dropping all parent data from +layout.server.ts, including auth data. This caused the client-side auth store to never initialize even though server-side cookies were present. Spread parent data in the return to ensure auth, isAuthenticated, and other server data flows to components properly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/routes/+layout.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 52cf5021..a404324b 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -12,7 +12,7 @@ import type { LayoutLoad } from './$types' import { browser } from '$app/environment' import { QueryClient } from '@tanstack/svelte-query' -export const load: LayoutLoad = async () => { +export const load: LayoutLoad = async ({ data }) => { const queryClient = new QueryClient({ defaultOptions: { queries: { @@ -30,5 +30,8 @@ export const load: LayoutLoad = async () => { } }) - return { queryClient } + return { + ...data, // Pass through parent data from +layout.server.ts (includes auth, isAuthenticated, etc.) + queryClient + } }