You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
It seams that trying to use Suspense as mentioned in the docs - https://reactrouter.com/how-to/suspense#with-react-19
doesn't work with Cloudfalre. The response waits to the NonCriticalUI to resolve on the server before rendering the full page.
import*asReactfrom"react";import{Await}from"react-router";importtype{Route}from"./+types/my-route";exportasyncfunctionloader({}: Route.LoaderArgs){// note this is NOT awaitedletnonCriticalData=newPromise((res)=>setTimeout(()=>res("non-critical"),5000));letcriticalData=awaitnewPromise((res)=>setTimeout(()=>res("critical"),300));return{ nonCriticalData, criticalData };}exportdefaultfunctionMyComponent({
loaderData,}: Route.ComponentProps){let{ criticalData, nonCriticalData }=loaderData;return(<div><h1>Streaming example</h1><h2>Critical data value: {criticalData}</h2><React.Suspensefallback={<div>Loading...</div>}><NonCriticalUIp={nonCriticalData}/></React.Suspense></div>);}functionNonCriticalUI({ p }: {p: Promise<string>}){letvalue=React.use(p);return<h3>Non critical value {value}</h3>;}
The text was updated successfully, but these errors were encountered:
Hi,
It seams that trying to use Suspense as mentioned in the docs - https://reactrouter.com/how-to/suspense#with-react-19
doesn't work with Cloudfalre. The response waits to the
NonCriticalUI
to resolve on the server before rendering the full page.The text was updated successfully, but these errors were encountered: