Replies: 3 comments 4 replies
-
|
Beta Was this translation helpful? Give feedback.
-
one thing i learned since is the concept of a universal loading function "shadowing" the server load function, as mentioned by @Rich-Harris here: #7107 (comment)
i tried to read the docs about loading function very carefully, however the "shadowing" concept was new to me, i.e. i didn't see that mentioned anywhere. also not in the place where it shortly mentions the possibility of having +layout.server.js+ and +layout.js simultaneously. Especially your quote
doesn't seem to be true without that caveat. Adding a |
Beta Was this translation helpful? Give feedback.
-
generally speaking, if i need to guard a route with a condition that relates to state that is outside of the scope of the server - then i would (need to) use the universal loading function for that right? Or do i mis-use/understand the loading function here and there is another mechanic for that? Also, i have SSR disabled - am i right to assume that universal loading functions only run on the client then? How would that work with SSR enabled? Would the universal loading function be delegated to the client if the server sees that it contains code like |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm hitting several issues/questions concerning what i can expect from
export let data: PageData
in+[page|layout].svelte
files.data that i return from
+layout.server.ts
is not available in the type in+page.svelte
in the same directory (viaimport { PageData} from './$types'
). However it seems to be available on runtime. Is this a bug in the generation of the type information or is this intended behaviour (i.e. you have to specifically forward layout load data in+page.server.ts
)i hit situations when something that is returned from the server load method is undefined on the client. from what i see this is related to using
goto
together withinvalidateAll
. Data is updated eventually however i see the error on the server console, so it's probably related to ssr. in my case the the load function in+layout.server.ts
returns something that can't be undefined however aftergoto
on the client, the corresponding+layout.svelte
triggers an undefined error when accessingdata.something.property
. Can't help but think that this is a bug, either in the server rendering/preload code or in the generate types, since they don't include undefined (thus not causing an error when not guarding for undefined in the IDE).Beta Was this translation helpful? Give feedback.
All reactions