react/packages
Andrew Clark 32eefcb3c5
Replace flushDiscreteUpdates with flushSync (#21775)
* Replace flushDiscreteUpdates with flushSync

flushDiscreteUpdates is almost the same as flushSync. It forces passive
effects to fire, because of an outdated heuristic, which isn't ideal but
not that important.

Besides that, the only remaining difference between flushDiscreteUpdates
and flushSync is that flushDiscreteUpdates does not warn if you call it
from inside an effect/lifecycle. This is because it might get triggered
by a nested event dispatch, like `el.focus()`.

So I added a new method, flushSyncWithWarningIfAlreadyRendering, which
is used for the public flushSync API. It includes the warning. And I
removed the warning from flushSync, so the event system can call that
one. In production, flushSyncWithWarningIfAlreadyRendering gets inlined
to flushSync, so the behavior is identical.

Another way of thinking about this PR is that I renamed flushSync to
flushSyncWithWarningIfAlreadyRendering and flushDiscreteUpdates to
flushSync (and fixed the passive effects thing). The point is to prevent
these from subtly diverging in the future.

* Invert so the one with the warning is the default one

To make Seb happy
2021-07-01 15:13:00 -07:00
..
create-subscription Updated scripts and config to replace "master" with "main" branch (#21768) 2021-06-29 14:26:24 -04:00
dom-event-testing-library Revise useFocus/useFocusWithin (#19310) 2020-07-10 17:23:00 +01:00
eslint-plugin-react-hooks Updated scripts and config to replace "master" with "main" branch (#21768) 2021-06-29 14:26:24 -04:00
jest-mock-scheduler Bump versions for 17 (#20062) 2020-10-20 21:41:18 +01:00
jest-react Remove internal `act` builds from public modules (#21721) 2021-06-22 14:29:35 -07:00
react Updated scripts and config to replace "master" with "main" branch (#21768) 2021-06-29 14:26:24 -04:00
react-art Make time-slicing opt-in (#21072) 2021-04-09 19:50:09 -04:00
react-cache Remove unstable_changedBits (#20953) 2021-03-19 15:36:51 -07:00
react-client Remove internal `act` builds from public modules (#21721) 2021-06-22 14:29:35 -07:00
react-debug-tools ReactDebugHooks optionally includes fileName, and line/column numbers (#21781) 2021-07-01 13:08:46 -04:00
react-devtools Updated scripts and config to replace "master" with "main" branch (#21768) 2021-06-29 14:26:24 -04:00
react-devtools-core DevTools: Show hook names based on variable usage (#21641) 2021-07-01 14:39:18 -04:00
react-devtools-extensions DevTools: Show hook names based on variable usage (#21641) 2021-07-01 14:39:18 -04:00
react-devtools-inline DevTools: Show hook names based on variable usage (#21641) 2021-07-01 14:39:18 -04:00
react-devtools-scheduling-profiler Updated scripts and config to replace "master" with "main" branch (#21768) 2021-06-29 14:26:24 -04:00
react-devtools-shared DevTools: Show hook names based on variable usage (#21641) 2021-07-01 14:39:18 -04:00
react-devtools-shell DevTools: Show hook names based on variable usage (#21641) 2021-07-01 14:39:18 -04:00
react-dom Replace flushDiscreteUpdates with flushSync (#21775) 2021-07-01 15:13:00 -07:00
react-fetch Resolve the true entry point during tests (#21505) 2021-06-02 18:03:29 -07:00
react-fs Add Flight packages to experimental allowlist (#20486) 2020-12-18 14:29:48 -08:00
react-interactions Remove internal `act` builds from public modules (#21721) 2021-06-22 14:29:35 -07:00
react-is Update entry point exports (#21488) 2021-05-12 11:28:14 -04:00
react-native-renderer Delete batchedEventUpdates (#21774) 2021-06-30 15:09:14 -07:00
react-noop-renderer Replace flushDiscreteUpdates with flushSync (#21775) 2021-07-01 15:13:00 -07:00
react-pg Add Flight packages to experimental allowlist (#20486) 2020-12-18 14:29:48 -08:00
react-reconciler Replace flushDiscreteUpdates with flushSync (#21775) 2021-07-01 15:13:00 -07:00
react-refresh Remove internal `act` builds from public modules (#21721) 2021-06-22 14:29:35 -07:00
react-server [Fizz/Flight] Don't use default args (#21681) 2021-06-14 15:28:20 -07:00
react-server-dom-relay Remove internal `act` builds from public modules (#21721) 2021-06-22 14:29:35 -07:00
react-server-dom-webpack Remove internal `act` builds from public modules (#21721) 2021-06-22 14:29:35 -07:00
react-server-native-relay Reland Remove redundant initial of isArray (#21188) 2021-04-07 07:57:43 -07:00
react-suspense-test-utils Add built-in Suspense cache with support for invalidation (refreshing) (#20456) 2020-12-18 10:57:24 -08:00
react-test-renderer `act`: Resolve to return value of scope function (#21759) 2021-06-26 11:51:23 -07:00
scheduler fix: maxYieldInterval should not compare with currentTime directly in Scheduler-shouldYieldToHost 2021-06-30 10:01:04 -04:00
shared `act` should work without mock Scheduler (#21714) 2021-06-22 14:25:07 -07:00
use-subscription Updated scripts and config to replace "master" with "main" branch (#21768) 2021-06-29 14:26:24 -04:00