dillon1000/react
Commit
Browse files Internal `act`: Flush timers at end of scope (#19788)
If there are any suspended fallbacks at the end of the `act` scope, force them to display by running the pending timers (i.e. `setTimeout`). The public implementation of `act` achieves the same behavior with an extra check in the work loop (`shouldForceFlushFallbacks`). Since our internal `act` needs to work in both development and production, without additional runtime checks, we instead rely on Jest's mock timers. This doesn't not affect refresh transitions, which are meant to delay indefinitely, because in that case we exit the work loop without posting a timer.
Changed paths10 files
First-parent comparisonpackages/react-dom/src/test-utils/ReactTestUtilsAct.js ModifiedM packages/react-noop-renderer/src/createReactNoop.js ModifiedM packages/react-reconciler/src/__tests__/ReactBlocks-test.js ModifiedM packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js ModifiedM packages/react-test-renderer/src/ReactTestRenderer.js ModifiedM scripts/rollup/validate/eslintrc.cjs.js ModifiedM scripts/rollup/validate/eslintrc.cjs2015.js ModifiedM scripts/rollup/validate/eslintrc.fb.js ModifiedM scripts/rollup/validate/eslintrc.rn.js ModifiedM scripts/rollup/validate/eslintrc.umd.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…