react/packages/shared
Andrew Clark 06f7b4f43a
`act` should work without mock Scheduler (#21714)
Currently, in a React 18 root, `act` only works if you mock the
Scheduler package. This was because we didn't want to add additional
checks at runtime.

But now that the `act` testing API is dev-only, we can simplify its
implementation.

Now when an update is wrapped with `act`, React will bypass Scheduler
entirely and push its tasks onto a special internal queue. Then, when
the outermost `act` scope exists, we'll flush that queue.

I also removed the "wrong act" warning, because the plan is to move
`act` to an isomorphic entry point, simlar to `startTransition`. That's
not directly related to this PR, but I didn't want to bother
re-implementing that warning only to immediately remove it.

I'll add the isomorphic API in a follow up.

Note that the internal version of `act` that we use in our own tests
still depends on mocking the Scheduler package, because it needs to work
in production. I'm planning to move that implementation to a shared
(internal) module, too.
2021-06-22 14:25:07 -07:00
..
__tests__ Clean up Scheduler forks (#20915) 2021-05-17 16:53:58 -04:00
forks `act` should work without mock Scheduler (#21714) 2021-06-22 14:25:07 -07:00
ConsolePatchingDev.js Add console group methods to dev disabled groups (#19069) 2020-07-08 17:28:49 +01:00
ExecutionEnvironment.js give `canUseDOM` with a possibility to be a constant (#14194) 2019-04-25 11:28:53 +01:00
ReactComponentStackFrame.js Add disableNativeComponentFrames flag (#20364) 2020-12-02 16:25:55 +01:00
ReactElementType.js Update Flow to 0.84 (#17805) 2020-01-09 14:50:44 +00:00
ReactErrorUtils.js Drop the year from Facebook copyright headers and the LICENSE file. (#13593) 2018-09-07 15:11:23 -07:00
ReactFeatureFlags.js `act` should work without mock Scheduler (#21714) 2021-06-22 14:25:07 -07:00
ReactInstanceMap.js Rename internal fields (#18377) 2020-03-24 18:19:20 +00:00
ReactSharedInternals.js Don't support older isomorphic React with newer renderers (#18329) 2020-03-17 19:30:10 +00:00
ReactSymbols.js Remove the Fundamental internals (#20745) 2021-02-05 20:36:55 +00:00
ReactTypes.js Remove unstable scheduler/tracing API (#20037) 2021-04-26 19:16:18 -04:00
ReactVersion.js Add single source of truth for package versions (#21608) 2021-06-02 20:54:26 -07:00
checkPropTypes.js Remove redundant initial of hasOwnProperty (#21134) 2021-04-01 09:05:10 -07:00
consoleWithStackDev.js Remove unnecessary throw catch (#19044) 2020-05-29 11:25:48 -07:00
enqueueTask.js Fix requiring timers module with non standard require (#18632) 2020-04-16 12:36:09 +01:00
formatProdErrorMessage.js Pass prod error messages directly to constructor (#17063) 2019-10-11 09:10:40 -07:00
getComponentNameFromType.js Renamed function in error log issue #21446 (#21449) 2021-05-06 21:03:21 -04:00
hasOwnProperty.js Remove redundant initial of hasOwnProperty (#21134) 2021-04-01 09:05:10 -07:00
invariant.js Compile invariant directly to throw expressions (#15071) 2019-03-18 13:58:03 -07:00
invokeGuardedCallbackImpl.js Update outdated links and fix two broken links (#19985) 2020-10-09 02:56:30 +01:00
isArray.js Reland Remove redundant initial of isArray (#21188) 2021-04-07 07:57:43 -07:00
isValidElementType.js [Offscreen] Mount/unmount layout effects (#21386) 2021-06-01 12:46:08 -07:00
objectIs.js Update to flow 0.97 (#17892) 2020-01-24 10:52:38 -08:00
package.json Drop Haste (#11303) 2017-10-25 02:55:00 +03:00
shallowEqual.js Remove redundant initial of hasOwnProperty (#21134) 2021-04-01 09:05:10 -07:00