dillon1000/react

Commit

Internal `act`: Call scope function after an async gap (#26347)

This adds an async gap to our internal implementation of `act` (the one
used by our repo, not the public API). Rather than call the provided
scope function synchronously when `act` is called, we call it in a
separate async task. This is an extra precaution to ensure that our
tests do not accidentally rely on work being queued synchronously,
because that is an implementation detail that we should be allowed to
change. We don't do this in the public version of `act`, though we maybe
should in the future, for the same rationale. That might be tricky,
though, because it could break existing tests.

This also fixes the issue where our internal `act` requires an async
function. You can pass it a regular function, too.
Browse files
Changed paths3 files
First-parent comparison
M packages/internal-test-utils/internalAct.js ModifiedM packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js ModifiedM packages/react-reconciler/src/__tests__/ReactSuspenseFuzz-test.internal.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…