You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've fetched data in a layout and a catch-all route server files, but only the catch-all route has the data pass to the .svelte file on the server.
Data fetched into the +layout.svelte only populates after first render.
Screen.Recording.2024-08-14.at.10.26.54.PM.mov
Notice the page loads with page data already rendered (the "Updated weekly..." copy), but the navigation content is initially empty.
My thought is, the useQuery function is not fully converted to Svelte 5 (Runes), but not sure if this is what's causing the layout data to load only after the initial render...
The text was updated successfully, but these errors were encountered:
mitchuman
changed the title
svelte-loader to update for the upcoming Svelte 5 (Runes)?
Data fetched in +layout.server.ts only loads after the initial render. [SvelteKit/Svelte 5 (Runes)]
Aug 15, 2024
mitchuman
changed the title
Data fetched in +layout.server.ts only loads after the initial render. [SvelteKit/Svelte 5 (Runes)]
Data fetched in +layout.server.ts only loads after the initial render [SvelteKit/Svelte 5 (Runes)]
Aug 15, 2024
Hello @mitchuman, @rdunk, did you find a solution or a workaround to this issue? I'm having the same issue now, having me setup a static splash while the data is being fetched from the layout. I'm now calling my Global settings query in each page to make the data available in the layout.svelte file but that seems quite unintuitive and clearly hacky... Thank you very much in advance!
Hi there, I'm allowing to answer my own question here. Taking the attached repo as a reference, the site data is not passed down to the layout.svelte file through layout.ts. layout.ts is only used to setPreviewing. So the data should be fetched in layout.server.ts, passed down to layout.ts along with preview. And then it can be directly used in layout.svelte. I don't know if that helps anyone but that actually how I found out how Svelte actually works ^^. I still can't get live previews to work though, if you have any idea on why the repo's setup doesn't work, I'll take it.
I've Converted the setup documented here to use Runes.
I've fetched data in a layout and a catch-all route server files, but only the catch-all route has the data pass to the .svelte file on the server.
Data fetched into the +layout.svelte only populates after first render.
Screen.Recording.2024-08-14.at.10.26.54.PM.mov
Notice the page loads with page data already rendered (the "Updated weekly..." copy), but the navigation content is initially empty.
My thought is, the
useQuery
function is not fully converted to Svelte 5 (Runes), but not sure if this is what's causing the layout data to load only after the initial render...For reference, I have a repo/repro here
The text was updated successfully, but these errors were encountered: