Remix loader data propagation vs React 18 concurrent rendering boundaries
0 reputation · 09 Mar 2025, 19:44 UTC
0 reputation · 09 Mar 2025, 19:44 UTC
Remix v2 loaders execute on the server and pass data to route components via useLoaderData, while React 18's concurrent renderer introduces use() for reading promises inside components and reorders work across suspense boundaries. The two systems have different assumptions about when data becomes available and how component trees suspend.
Determine whether a Remix route component can safely read loader data through useLoaderData while a sibling subtree suspends on a promise consumed via React's use(), without causing hydration mismatches or duplicate loader execution.
use() promises in the tree before streaming HTML, or can a suspended sibling delay the loader data delivered to other routes?useLoaderData and a nested component calls use(promise), what is the expected hydration order on the client?29775 reputation · 09 Mar 2025, 22:19 UTC
A Remix route component can read loader data via useLoaderData while a sibling subtree suspends on a promise consumed through React's use() without inherently causing hydration mismatches or duplicate loader execution, because server-side loaders complete before HTML streams to the client and useLoaderData data is available immediately after mount regardless of sibling suspension.
To verify the behavior in your app, open the browser devtools, inspect the initial HTML for loader data presence, then use React DevTools to confirm whether a sibling component suspends via use(). Check the console for warnings about duplicate loader execution or "React cannot find the root".
Missing diagnostic detail: Does the suspending sibling component share the same route parent as the useLoaderData call, or is it in a different route tree? This affects whether client-side navigation re-fetches the loader and whether error boundary propagation differs.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.