sveltejs / sveltejs/kit

parent load function doesn't rerun

Open
#14,356 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

https://svelte.dev/docs/kit/load#Rerunning-load-functions-Manual-invalidation stands:
"A child load function calls await parent() and is rerunning, and the parent is a server load function"
but in this example
1)I have load function in +layout.js in blob. It depends on "some:label" and has "await parent()"
2)I have "+layout.server.js" in root
3)Call invalidate("some:label") reruns load function in blog, but not root server load.
Why?

Reproduction

https://codesandbox.io/p/devbox/my8q4j
run app
click on "to blog"
open server and browser console
click invalidate
in server console no "root layout server load" message
it means that root server load doesn't rerun.

Logs

System Info
System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (2) x64 AMD EPYC
    Memory: 2.17 GB / 4.01 GB
    Container: Yes
    Shell: Unknown
  Binaries:
    Node: 20.12.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.5.0 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/share/npm-global/bin/pnpm
  npmPackages:
    @sveltejs/adapter-auto: ^6 => 6.1.0 
    @sveltejs/kit: ^2 => 2.37.0 
    @sveltejs/vite-plugin-svelte: ^5 => 5.1.1 
    svelte: ^5 => 5.38.6 
    vite: ^6 => 6.3.5
Severity

annoyance

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked manual invalidation documentation and run the CodeSandbox reproduction. Trace the root +layout.server.js load, the blog +layout.js load, and invalidate("some:label") to compare the documented and observed rerun behavior. Done means the behavior is explained and the implementation or documentation is aligned with the intended semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.