dillon1000/react
Commit
Browse files useDeferredValue should skip initialValue if it suspends (#27509)
### Based on https://github.com/facebook/react/pull/27505 If a parent render spawns a deferred task with useDeferredValue, but the parent render suspends, we should not wait for the parent render to complete before attempting to render the final value. The reason is that the initialValue argument to useDeferredValue is meant to represent an immediate preview of the final UI. If we can't render it "immediately", we might as well skip it and go straight to the "real" value. This is an improvement over how a userspace implementation of useDeferredValue would work, because a userspace implementation would have to wait for the parent task to commit (useEffect) before spawning the deferred task, creating a waterfall.
Changed paths7 files
First-parent comparisonpackages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js ModifiedM packages/react-devtools-shared/src/__tests__/preprocessData-test.js ModifiedM packages/react-reconciler/src/ReactFiberHooks.js ModifiedM packages/react-reconciler/src/ReactFiberLane.js ModifiedM packages/react-reconciler/src/ReactFiberWorkLoop.js ModifiedM packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js ModifiedM packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…