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:
@gavriguy I think this might be some issue with wrangler since it only fails when I run npm run start. It does work properly when I run npm run dev and when I deploy to cloudflare (not I am using the template from #6, not sure if it resolved something)
I'm not sure if there's something we can do in our template to fix this issue, so I'll leave it open for now
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: