Parent Layout Data is not sent to page when invalidated by `await parent()`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
When a +layout.server.ts load function is re-ran on the server side via await parent(), the data it returns is not sent down to the page.
This should either be considered a bug since the function is called and the data is already calculated, but it is not sent to the page, or there should be some way to manually invalidate it on the server-side (invalidate is client-only).
Note that invalidate does produce the expected result when called from the client.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-xhrebt?file=src/routes/+layout.server.ts
Logs
No response
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 7.17.0 - /usr/local/bin/npm
npmPackages:
@sveltejs/adapter-auto: ^2.0.0 => 2.0.0
@sveltejs/kit: ^1.5.0 => 1.10.0
svelte: ^3.54.0 => 3.55.1
vite: ^4.0.0 => 4.1.4
Severity
serious, but I can work around it
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the StackBlitz reproduction and src/routes/+layout.server.ts, then trace how await parent() reruns the server-side layout load and transfers its data to the page. Verify the behavior with the reported SvelteKit versions; done means the parent layout data is delivered to the page after server-side invalidation without breaking the client-side invalidate behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- full-stack, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100