Closed ToP29 closed 1 year ago
This happens because disabling SSR in +layout.js
causes +layout.server.js
to never run for any pages. Hence, data
is never populated by the server load function.
Maybe this is the intended behavior, but I've been facing a similar bug and just did some testing by putting console.log
s at the top of each of the handle
, load
(server), load
(client), functions, and these are the logs, in order:
+layout.ts
:
event.isDataRequest === false
)event.isDataRequest === true
)event.isDataRequest === false
)data == null
because server load didn't run)+layout.ts
:
data != null
because server load did run)Note: I'm using "@sveltejs/kit": "^1.22.6"
.
Describe the bug
When i turn off ssr (in +layout.js) and 404 error happens, then data is always null in +layout.js in load function
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-ck2eek?file=src%2Froutes%2F%2Blayout.js&terminal=dev
go to some non-existing page and try turning ssr on and off and observe log in console
Logs
No response
System Info
Severity
blocking all usage of SvelteKit
Additional Information
No response