-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Layout invalidated when referencing missing search param #10504
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
Comments
Possibly the same/related? Although I'm seeing the invalidation happen even when there is no |
Got it and thanks for the info. Here's the docs that need to be updated to match the behavior: https://kit.svelte.dev/docs/load#rerunning-load-functions-when-do-load-functions-rerun "It references a property of url (such as url.pathname or url.search) whose value has changed." In my case the search param is not set, which means the value of url.searchParams hasn't changed, even though url.pathname has. |
Based on the conversations here: - sveltejs#10504 - sveltejs#8403 Any changes to the URL will cause any `load` functions that access `url.searchParams` to be rerun even if the search portion of the URL has not changed (or indeed if there are no search params in the URL.)
Describe the bug
I have a layout that loads some data based on a search param. If the search param is not provided, I expect the layout to not be re-run on navigation to child routes. However, it appears that the layout will be re-run on every child route change, despite the search param never being provided.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-dkhony?file=src%2Froutes%2F%2Blayout.server.js
Logs
No response
System Info
Severity
blocking an upgrade
Additional Information
Something else to note is that I'm using a wildcard route.
The text was updated successfully, but these errors were encountered: