Description
Server fetches not being tracked is documented in https://svelte.dev/docs/kit/load#Rerunning-load-functions-When-do-load-functions-rerun and https://svelte.dev/docs/kit/load#Rerunning-load-functions-Manual-invalidation but could also be mentioned in the fetch
and depends
functions of https://svelte.dev/docs/kit/@sveltejs-kit#LoadEvent and https://svelte.dev/docs/kit/$app-navigation#invalidate
The comment in
could also be updated to mention what those "security concerns" are. e.g., leaking secrets like the current documentation suggestsDiscussed in #13798
Originally posted by pjeziorowski May 16, 2025
Quick question: Will calling invalidate(myBackendEndpoint)
on the client side invalidate or rerun a backend (.server.ts) load function that uses SvelteKit's fetch to get data from myBackendEndpoint
?
I've noticed that invalidate(myBackendEndpoint)
works well when I load data in +page.ts
, but it doesn't seem to invalidate when the data loading is moved to +page.server.ts
. I also noticed that this server loader isn't dependent on any URL, even though it makes a fetch
call to myBackendEndpoint
🤔
Is this the expected behavior? I looked for more information in the documentation, but it doesn't seem to be explicitly covered there.