Skip to content

invalidate('...') doesn't work after navigating to a page with parameters #6354

@aradalvand

Description

@aradalvand

Describe the bug

Repro: https://github.com/aradalvand/sveltekit-invalidate-with-params

It seems like having a route with params (e.g. routes/whatever/[id]) along with a load function that have depends(...) doesn't work as expected, when you navigate to that page with the client-side router, and then run invalidate('...'), it won't work. Very weird. I'm pretty confident this is a bug.

Reproduction

  • Clone https://github.com/aradalvand/sveltekit-invalidate-with-params
  • Run and open the app (the home page) in the browser
  • Open the console, run invalidate('user'). You'll see that the layout's load function gets re-run, as expected:
    image
  • Now, click on the link in the home page titled "Go to foo"
  • After navigating to the /foo/123 page, open the console and run the same command again. This time, it won't work, the layout's load function isn't re-run:
    image

Logs

No response

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
    Memory: 486.11 MB / 3.77 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 16.15.1 - /usr/bin/node
    npm: 8.11.0 - /usr/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.65
    @sveltejs/kit: next => 1.0.0-next.445
    svelte: ^3.44.0 => 3.49.0
    vite: ^3.0.4 => 3.0.9

Severity

blocking all usage of SvelteKit

Additional Information

The problem only exists for pages that have parameters, I have no idea why, but I think this information could be useful for diagnosing the problem.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions