dillon1000/react
Commit
Browse files [Bugfix] Infinite uDV loop in popstate event (#32821)
Found a bug that occurs during a specific combination of very subtle implementation details. It occurs sometimes (not always) when 1) a transition is scheduled during a popstate event, and 2) as a result, a new value is passed to an already-mounted useDeferredValue hook. The fix is relatively straightforward, and I found it almost immediately; it took a bit longer to figure out exactly how the scenario occurred in production and create a test case to simulate it. Rather than couple the test to the implementation details, I've chosen to keep it as high-level as possible so that it doesn't break if the details change. In the future, it might not be trigger the exact set of internal circumstances anymore, but it could be useful for catching similar bugs because it represents a realistic real world situation — namely, switching tabs repeatedly in an app that uses useDeferredValue.
Changed paths2 files
First-parent comparisonpackages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js ModifiedM packages/react-reconciler/src/ReactFiberHooks.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…