Skip to content

Are .server.ts fetch dependencies tracked? #13798

Answered by eltigerchino
pjeziorowski asked this question in Q&A
Discussion options

You must be logged in to vote

I did some digging and it is documented (albeit we could do better) https://svelte.dev/docs/kit/load#Rerunning-load-functions-Manual-invalidation

Server load functions will never automatically depend on a fetched url to avoid leaking secrets to the client.

This probably makes sense since a server fetch could have some sensitive information in the URL if it's making a request to a private endpoint.

Fortunately, you explicitly track it using the depends function which is passed to https://svelte.dev/docs/kit/@sveltejs-kit#LoadEvent (scroll down a little to find the description).

This function declares that the load function has a dependency on one or more URLs or custom identifiers, whic…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@eltigerchino
Comment options

Answer selected by eltigerchino
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants