Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
themajashurka opened this issue Jun 8, 2023 · 1 comment · Fixed by #11870
Closed

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

themajashurka opened this issue Jun 8, 2023 · 1 comment · Fixed by #11870
Labels
bug Something isn't working forms Stuff relating to forms and form actions ready to implement please submit PRs for these issues!

Comments

@themajashurka
Copy link

themajashurka commented Jun 8, 2023

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

@themajashurka themajashurka changed the title depends('') stops working as expected after form submission depends() stops working as expected after form submission Jun 8, 2023
@elliott-with-the-longest-name-on-github elliott-with-the-longest-name-on-github added bug Something isn't working forms Stuff relating to forms and form actions ready to implement please submit PRs for these issues! labels Jun 10, 2023
@HanLap
Copy link

HanLap commented Oct 17, 2023

Hi,
this seems to happen because the enhance-action calls invalidateAll.

invalidate_all sets force_invalidation to true, which causes all following invalidate calls to invalidate everything.

Similar behavior is described in #10677.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forms Stuff relating to forms and form actions ready to implement please submit PRs for these issues!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants