dillon1000/react
Commit
Browse files Flush discrete passive effects before paint (#21150)
If a discrete render results in passive effects, we should flush them synchronously at the end of the current task so that the result is immediately observable. For example, if a passive effect adds an event listener, the listener will be added before the next input. We don't need to do this for effects that don't have discrete/sync priority, because we assume they are not order-dependent and do not need to be observed by external systems. For legacy mode, we will maintain the existing behavior, since it hasn't been reported as an issue, and we'd have to do additional work to distinguish "legacy default sync" from "discrete sync" to prevent all passive effects from being treated this way.
Changed paths5 files
First-parent comparisonpackages/react-reconciler/src/ReactFiberWorkLoop.new.js ModifiedM packages/react-reconciler/src/ReactFiberWorkLoop.old.js ModifiedM packages/react-reconciler/src/__tests__/ReactFlushSync-test.js ModifiedM packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js ModifiedM packages/react/src/__tests__/ReactProfiler-test.internal.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…