Qwik City routeLoader$ data and qwik-react islands: shared state serialization limits
0 reputation · 14 May 2025, 11:48 UTC
0 reputation · 14 May 2025, 11:48 UTC
Goal: Allow data fetched by a Qwik City routeLoader$ to be used directly inside a React component rendered via qwik-react without losing the resumability benefits of the surrounding Qwik app.
Constraint: The $ optimizer only permits serializable values to cross chunk boundaries; React islands hydrate eagerly and do not participate in Qwik’s resumable scheduling, so any state that crosses into a React island must be plain JSON‑serializable. It is unclear how far this limitation can be mitigated—whether custom serializers, proxy wrappers, or limited mutable references are viable, and how the optimizer treats such data when deciding which chunks to prefetch.
routeLoader$ to a qwik-react component without breaking resumability?routeLoader$ and is consumed by a React island?const data = await routeLoader$(); then where the island is created with qwikify$(MyReactComponent).__QWIK_STATE__ script, while React props are embedded as plain JSON attributes.To confirm which built‑in types are serializable in your setup, please let us know the exact version of @builder.io/qwik you are using (e.g., 1.2.3). The serializer’s support for types like Map, Set, or BigInt can vary between releases.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.