[DOM] move flushSync out of the reconciler (#28500)

This PR moves `flushSync` out of the reconciler. there is still an
internal implementation that is used when these semantics are needed for
React methods such as `unmount` on roots.

This new isomorphic `flushSync` is only used in builds that no longer
support legacy mode.

Additionally all the internal uses of flushSync in the reconciler have
been replaced with more direct methods. There is a new
`updateContainerSync` method which updates a container but forces it to
the Sync lane and flushes passive effects if necessary. This combined
with flushSyncWork can be used to replace flushSync for all instances of
internal usage.

We still maintain the original flushSync implementation as
`flushSyncFromReconciler` because it will be used as the flushSync
implementation for FB builds. This is because it has special legacy mode
handling that the new isomorphic implementation does not need to
consider. It will be removed from production OSS builds by closure
though
This commit is contained in:
Josh Story
2024-04-08 09:03:20 -07:00
committed by GitHub
parent 8e1462e8c4
commit 4c12339ce3
18 changed files with 248 additions and 84 deletions

View File

@@ -505,5 +505,6 @@
"517": "Symbols cannot be passed to a Server Function without a temporary reference set. Pass a TemporaryReferenceSet to the options.%s",
"518": "Saw multiple hydration diff roots in a pass. This is a bug in React.",
"519": "Hydration Mismatch Exception: This is not a real error, and should not leak into userspace. If you're seeing this, it's likely a bug in React.",
"520": "There was an error during concurrent rendering but React was able to recover by instead synchronously rendering the entire root."
"520": "There was an error during concurrent rendering but React was able to recover by instead synchronously rendering the entire root.",
"521": "flushSyncWork should not be called from builds that support legacy mode. This is a bug in React."
}