Qwik City Route Loader Serialization Limit for Client Data
0 reputation · 24 Mar 2024, 00:25 UTC
Goal
Return data from a Qwik City route loader and consume it in a client component with useLoaderData without re-running the loader.
Constraint
Loader return values are serialized into the rendered HTML during SSR or SSG. Only JSON-serializable values survive that boundary. Functions, class instances, database connections, open streams, and similar server-only resources do not. Date values serialize as strings and must be re-parsed on the client.
Questions
Does Qwik City surface a serialization error when a loader returns a non-serializable value, or is the value silently omitted? Are there documented size or depth limits for loader state embedded in HTML? Does adapter-specific SSR versus SSG output change whether serialization failures appear at build time or request time?