Problem
stx has useFetch/useAsyncData, server scripts, and a server-to-client data bridge, but these do not provide an automatic request-scoped fetch-to-hydration lifecycle. Applications must manually connect server-loaded data to client fetching state.
The goal is to fetch once for SSR and reuse that result during browser hydration, while retaining explicit refresh and navigation behavior.
Existing foundation
Reviewed at 7d93c4c: use-fetch.ts and signals.ts.
#1869 already implemented concurrent useQuery deduplication. This request builds on that work; it does not propose rebuilding it.
Scope and acceptance criteria
- Provide a keyed server data-loading API and integrate its results into the client data layer.
- Preserve the rule that only script server runs server-side; do not implicitly execute client scripts on the server.
- A server render followed by hydration makes one underlying data request for a hydrated key.
- Concurrent SSR requests cannot share private data accidentally.
- Define refresh, invalidation, navigation, failed-load, and missing-payload behavior.
- Preserve existing deduplication, superseding-request, and unmount-cancellation guarantees.
- Add end-to-end request-count and request-isolation tests and document usage.
Prior art: Nuxt data fetching.