fix: pass auth data from server to client layout

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 <noreply@anthropic.com>
This commit is contained in:
Justin Edmund 2025-11-29 02:22:03 -08:00
parent 908fc5a44a
commit a0939ec695

View file

@ -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
}
}