Universal (+page.ts/+layout.ts) load functions run on the server during SSR and run again in the browser during hydration. Their return value is not serialized into the page (unlike +page.server.ts data); instead, SvelteKit inlines the responses of fetches made through the load-provided fetch and replays them during the client re-run.
Two independent ways to silently lose the replay and double-fetch all data on first paint:
SDK calls that don't use the load's
fetch. A generated client (oazapfts etc.) configured via module-level defaults uses global fetch — SvelteKit never sees it, nothing is inlined, and the hydration re-run hits the network for everything. Fix: pass the load event'sfetchper call (oazapfts: trailingoptsargument{ fetch }).SSR and client using different API base URLs. Replay matches on request URL (+body). If the server fetches
http://api:8081/...(internal docker/K8s URL) while the browser fetcheshttps://api.example.com/..., nothing matches — worse, the inlined responses are dead page weight. Fix: use the public API URL as the SDK baseUrl in both bundles, and rewrite to the internal URL server-side in ahandleFetchhook (new Request(INTERNAL + request.url.slice(PUBLIC.length), request)— the recorded/replayed URL is the one the load requested, pre-rewrite, so the match holds).
Also required: filterSerializedResponseHeaders in resolve() must allow content-type, or replayed responses lose their type.
Verification that replay works: intercept browser requests in Playwright during goto() of an SSR'd page — there should be zero browser requests to the API endpoints the load calls (the SSR fetch is server-side and invisible to the browser).