Qwik City routeLoader$ data and qwik-react islands: shared state serialization limits
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.
- What kinds of values (e.g., plain objects, arrays, dates, class instances) can be safely passed from a
routeLoader$to aqwik-reactcomponent without breaking resumability? - Is there a supported pattern for wrapping non‑serializable objects in serializable proxies that preserve behavior across the boundary?
- How does the Qwik optimizer handle chunk loading for state that originates in a
routeLoader$and is consumed by a React island?