Putting export const ssr = true into the root layout.svelte and layout.js/ts does not work, and breaks goto as it still tries to render on server.
Reproduction
Place export const ssr = true into the root layout.svelte and/or layout.js/ts
Try using GOTO, or window.location.href = "/login"
Server nukes itself
Logs
ReferenceError: window is not defined
at /Users/yadev/Github/vistrem/svelte-frontend/src/lib/components/authcheck/Authcheck.svelte:10:9
at Object.$$render (/Users/yadev/Github/vistrem/svelte-frontend/node_modules/svelte/src/runtime/internal/ssr.js:156:16)
at eval (/Users/yadev/Github/vistrem/svelte-frontend/src/routes/case/[id]/+layout.svelte:25:97)
at Object.$$render (/Users/yadev/Github/vistrem/svelte-frontend/node_modules/svelte/src/runtime/internal/ssr.js:156:16)
at Object.default (/Users/yadev/Github/vistrem/svelte-frontend/.svelte-kit/generated/root.svelte:47:42)
at eval (/Users/yadev/Github/vistrem/svelte-frontend/src/routes/+layout.svelte:13:41)
at Object.$$render (/Users/yadev/Github/vistrem/svelte-frontend/node_modules/svelte/src/runtime/internal/ssr.js:156:16)
at /Users/yadev/Github/vistrem/svelte-frontend/.svelte-kit/generated/root.svelte:45:40
at $$render (/Users/yadev/Github/vistrem/svelte-frontend/node_modules/svelte/src/runtime/internal/ssr.js:156:16)
at Object.render (/Users/yadev/Github/vistrem/svelte-frontend/node_modules/svelte/src/runtime/internal/ssr.js:164:17)
/Users/yadev/Github/vistrem/svelte-frontend/src/lib/api/auth.api.ts:11
throw new Error(`Error checking login status: ${error}`);
^
Error: Error checking login status: Error: Error fetching data from /v1/auth/: Error: Cannot use relative URL (/v1/auth/) with global fetch — use `event.fetch` instead: https://kit.svelte.dev/docs/web-standards#fetch-apis
at Module.isLoggedIn (/Users/yadev/Github/vistrem/svelte-frontend/src/lib/api/auth.api.ts:11:11)
at async checkLoggedIn (/Users/yadev/Github/vistrem/svelte-frontend/src/lib/stores/auth.ts:17:22)
Node.js v20.10.0
Describe the bug
Putting
export const ssr = true
into the rootlayout.svelte
andlayout.js/ts
does not work, and breaks goto as it still tries to render on server.Reproduction
Place
export const ssr = true
into the rootlayout.svelte
and/orlayout.js/ts
Try using GOTO, or
window.location.href = "/login"
Server nukes itself
Logs
System Info
Severity
serious, but I can work around it
Additional Information
No response