You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Layout invalidated when referencing missing search param #10504
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.
It's indeed a duplicate of #8403, closing in favor of that. Your use case is the same: You listen to searchParams, which means as soon as anything happens with the URL the layout is rerun, which you don't want. #8403 would solve that.
Activity
coryvirok commentedon Aug 8, 2023
Possibly the same/related? Although I'm seeing the invalidation happen even when there is no
searchParams.#8403
dummdidumm commentedon Aug 8, 2023
It's indeed a duplicate of #8403, closing in favor of that. Your use case is the same: You listen to
searchParams, which means as soon as anything happens with the URL the layout is rerun, which you don't want. #8403 would solve that.coryvirok commentedon Aug 8, 2023
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.
Update 20-load.md to clarify load rerun behavior