TanStackT
TanStack3y ago
4 replies
rubber-blue

SSR + SvelteKit w/prefetching data should only fetch during the prefetch and not client-side

The expected behavior is that there isn't an initial fetch on the client.

From the provided SSR example (https://tanstack.com/query/latest/docs/svelte/examples/svelte/ssr), it seems that there are two fetches occurring (one for the prefetch and one on the client) when I observe the events in the network tab in the screenshot (i.e. after hitting the browser refresh button for the CodeSandbox).

Am I misinterpreting the intended behavior/implementation of this feature?

Edit: the expected behavior is that the data is present on the page prior to any client-side fetches; and additional fetches are done in the background to update the state
image.png
An example showing how to implement Ssr), in Svelte Query
Svelte Query Ssr), Example | TanStack Query Docs
Was this page helpful?