Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Better document that server load function fetches aren't tracked #13805

Open
@eltigerchino

Description

@eltigerchino

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

// Note: server fetches are not added to uses.depends due to security concerns
could also be updated to mention what those "security concerns" are. e.g., leaking secrets like the current documentation suggests

Discussed 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions