Skip to content

depends() stops working as expected after form submission #10123

@themajashurka

Description

@themajashurka

Describe the bug

Registering a custom dependency with depends('load:child') within a page's load function, and calling invalidate('load:child') with setInterval in the sibling +page.svelte in order to mimic a single polling behaviour, causes +layout.server's load function to be called as well after submitting form on same page.

Reproduction

https://github.com/themajashurka/depends-repro

Go to /child. You should see periodic logs on server about child load function being called.
Submit form. Now layout load function is called too.

Logs

server-side

root load runs
layout load runs
child load runs
child load runs
child load runs
child load runs
child load runs
child load runs
layout load runs
child load runs
layout load runs
child load runs
layout load runs
child load runs
layout load runs
child load runs
layout load runs

System Info

System:
    OS: macOS 11.7.7
    CPU: (4) x64 Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
    Memory: 879.37 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 18.14.0 - /usr/local/bin/node
    npm: 9.3.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 114.0.5735.106
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.0 
    @sveltejs/kit: ^1.5.0 => 1.20.2 
    svelte: ^3.54.0 => 3.59.1 
    vite: ^4.3.0 => 4.3.9

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingformsStuff relating to forms and form actionsready to implementplease submit PRs for these issues!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions