mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Add enableAsyncSubtreeAPI to host config
Allows us to control this feature on a per-renderer basis
This commit is contained in:
1 parent
864973c544
commit
26d70fd334
3 files changed
+7
-1
No files matched your search
@@ -364,6 +364,7 @@ var DOMRenderer = ReactFiberReconciler({
|
||||
scheduleDeferredCallback: ReactDOMFrameScheduling.rIC,
|
||||
|
||||
useSyncScheduling: !ReactDOMFeatureFlags.fiberAsyncScheduling,
|
||||
enableAsyncSubtreeAPI: ReactDOMFeatureFlags.enableAsyncSubtreeAPI,
|
||||
});
|
||||
|
||||
ReactGenericBatching.injection.injectFiberBatchedUpdates(
|
||||
|
||||
@@ -115,6 +115,7 @@ export type HostConfig<T, P, I, TI, PI, C, CX, PL> = {
|
||||
resetAfterCommit(): void,
|
||||
|
||||
useSyncScheduling?: boolean,
|
||||
enableAsyncSubtreeAPI?: boolean,
|
||||
};
|
||||
|
||||
export type Reconciler<C, I, TI> = {
|
||||
|
||||
@@ -169,6 +169,7 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
|
||||
useSyncScheduling,
|
||||
prepareForCommit,
|
||||
resetAfterCommit,
|
||||
enableAsyncSubtreeAPI,
|
||||
} = config;
|
||||
|
||||
// The priority level to use when scheduling an update. We use NoWork to
|
||||
@@ -1347,7 +1348,10 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
|
||||
function getPriorityContext(fiber: Fiber): PriorityLevel {
|
||||
let priorityLevel = priorityContext;
|
||||
if (priorityLevel === NoWork) {
|
||||
if (!useSyncScheduling || fiber.contextTag & AsyncUpdates) {
|
||||
if (
|
||||
!useSyncScheduling ||
|
||||
(enableAsyncSubtreeAPI === true && fiber.contextTag & AsyncUpdates)
|
||||
) {
|
||||
priorityLevel = LowPriority;
|
||||
} else {
|
||||
priorityLevel = SynchronousPriority;
|
||||
|
||||
Reference in new issue
Block a user