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
I am excited to start using React v19 as it has so many features and QoL improvements I've been waiting for!
There is a bug (new bug comparing to v18.2.0) that I found while reproducing #26814. When using useTransition() with use(), pending flag of transition correctly becomes true in the beginning, but doesn't go back to false after transition is complete, which means any pending state artifacts in the UI remain visible.
Basic code (since the repo contains more than just this bug):
functionSimpleAsyncFlow(){// this state holds instance of a promise that resolves after a second// the same `delayed()` function is used to trigger state update inside SimpleControlledDisplaylet[value,setValue]=useState(()=>delayed(Math.random()));return(<Suspensefallback={<p>Loading</p>}><SimpleControlledDisplaypromise={value}onChange={setValue}/></Suspense>);}functionSimpleControlledDisplay({
promise,
onChange,}: {promise: Promise<number>;onChange: (value: Promise<number>)=>void;}){letvalue=use(promise);let[pending,startTransition]=useTransition();letclick=()=>{// this will trigger state update in the parent with the new 1 second promise // that suppose to suspend this component, so transition should prevent itstartTransition(()=>{onChange(delayed(Math.random()));});};return(<div><buttononClick={click}>Refresh</button>{/* as UI "pending" state I update text style to become half transparent */}<pstyle={{opacity: pending ? 0.5 : 1}}>{value}</p></div>);}functiondelayed<T>(value: T){returnnewPromise<T>((resolve)=>setTimeout(resolve,1000,value));}
Additionally here's the video reproduction, using the code from the repo I mentioned:
Summary
I am excited to start using React v19 as it has so many features and QoL improvements I've been waiting for!
There is a bug (new bug comparing to v18.2.0) that I found while reproducing #26814. When using
useTransition()withuse(),pendingflag of transition correctly becomestruein the beginning, but doesn't go back tofalseafter transition is complete, which means any pending state artifacts in the UI remain visible.Repository for reproducing: https://github.com/alexeyraspopov/react-beta-bugs.
Basic code (since the repo contains more than just this bug):
Additionally here's the video reproduction, using the code from the repo I mentioned:
Screen.Recording.2024-04-26.at.08.27.42.mov