From 1a7d9aeb0a127d78122bf59ec6e08484462538d1 Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Mon, 22 Feb 2021 10:42:41 -0700 Subject: [PATCH] Land enableNonInterruptingNormalPri --- .../src/ReactFiberLane.new.js | 8 ++--- .../src/ReactFiberLane.old.js | 8 ++--- .../src/__tests__/ReactTransition-test.js | 36 ++++++------------- packages/shared/ReactFeatureFlags.js | 2 -- .../forks/ReactFeatureFlags.native-fb.js | 1 - .../forks/ReactFeatureFlags.native-oss.js | 1 - .../forks/ReactFeatureFlags.test-renderer.js | 1 - .../ReactFeatureFlags.test-renderer.native.js | 1 - .../ReactFeatureFlags.test-renderer.www.js | 1 - .../shared/forks/ReactFeatureFlags.testing.js | 1 - .../forks/ReactFeatureFlags.testing.www.js | 1 - .../forks/ReactFeatureFlags.www-dynamic.js | 1 - .../shared/forks/ReactFeatureFlags.www.js | 1 - 13 files changed, 14 insertions(+), 49 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberLane.new.js b/packages/react-reconciler/src/ReactFiberLane.new.js index e4280582e80cd..5f14a3140e30f 100644 --- a/packages/react-reconciler/src/ReactFiberLane.new.js +++ b/packages/react-reconciler/src/ReactFiberLane.new.js @@ -36,10 +36,7 @@ export type Lane = number; export type LaneMap = Array; import invariant from 'shared/invariant'; -import { - enableCache, - enableNonInterruptingNormalPri, -} from 'shared/ReactFeatureFlags'; +import {enableCache} from 'shared/ReactFeatureFlags'; import { ImmediatePriority as ImmediateSchedulerPriority, @@ -348,8 +345,7 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes { // Default priority updates should not interrupt transition updates. The // only difference between default updates and transition updates is that // default updates do not support refresh transitions. - (enableNonInterruptingNormalPri && - nextLanePriority === DefaultLanePriority && + (nextLanePriority === DefaultLanePriority && wipLanePriority === TransitionPriority) ) { // Keep working on the existing in-progress tree. Do not interrupt. diff --git a/packages/react-reconciler/src/ReactFiberLane.old.js b/packages/react-reconciler/src/ReactFiberLane.old.js index fe7d6eb7508c8..3c3eab4c8612f 100644 --- a/packages/react-reconciler/src/ReactFiberLane.old.js +++ b/packages/react-reconciler/src/ReactFiberLane.old.js @@ -36,10 +36,7 @@ export type Lane = number; export type LaneMap = Array; import invariant from 'shared/invariant'; -import { - enableCache, - enableNonInterruptingNormalPri, -} from 'shared/ReactFeatureFlags'; +import {enableCache} from 'shared/ReactFeatureFlags'; import { ImmediatePriority as ImmediateSchedulerPriority, @@ -348,8 +345,7 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes { // Default priority updates should not interrupt transition updates. The // only difference between default updates and transition updates is that // default updates do not support refresh transitions. - (enableNonInterruptingNormalPri && - nextLanePriority === DefaultLanePriority && + (nextLanePriority === DefaultLanePriority && wipLanePriority === TransitionPriority) ) { // Keep working on the existing in-progress tree. Do not interrupt. diff --git a/packages/react-reconciler/src/__tests__/ReactTransition-test.js b/packages/react-reconciler/src/__tests__/ReactTransition-test.js index 25072eb465ad9..09ba5dded7307 100644 --- a/packages/react-reconciler/src/__tests__/ReactTransition-test.js +++ b/packages/react-reconciler/src/__tests__/ReactTransition-test.js @@ -946,33 +946,17 @@ describe('ReactTransition', () => { updateNormalPri(); }); - if (gate(flags => flags.enableNonInterruptingNormalPri)) { - expect(Scheduler).toHaveYielded([ - // Finish transition update. - 'Normal pri: 0', - 'Commit', - - // Normal pri update. - 'Transition pri: 1', - 'Normal pri: 1', - 'Commit', - ]); - - expect(root).toMatchRenderedOutput('Transition pri: 1, Normal pri: 1'); - } else { - expect(Scheduler).toHaveYielded([ - // Interrupt! Render normal pri update. - 'Transition pri: 0', - 'Normal pri: 1', - 'Commit', + expect(Scheduler).toHaveYielded([ + // Finish transition update. + 'Normal pri: 0', + 'Commit', - // Restart transition update. - 'Transition pri: 1', - 'Normal pri: 1', - 'Commit', - ]); + // Normal pri update. + 'Transition pri: 1', + 'Normal pri: 1', + 'Commit', + ]); - expect(root).toMatchRenderedOutput('Transition pri: 1, Normal pri: 1'); - } + expect(root).toMatchRenderedOutput('Transition pri: 1, Normal pri: 1'); }); }); diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 3d0362f4b3fcd..778881bc5837d 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -147,8 +147,6 @@ export const enableRecursiveCommitTraversal = false; export const disableSchedulerTimeoutInWorkLoop = false; -export const enableNonInterruptingNormalPri = false; - export const enableDiscreteEventMicroTasks = false; export const enableNativeEventPriorityInference = false; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index f97f4f428c181..6544be4cbe040 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -57,7 +57,6 @@ export const enableUseRefAccessWarning = false; export const enableRecursiveCommitTraversal = false; export const disableSchedulerTimeoutInWorkLoop = false; -export const enableNonInterruptingNormalPri = false; export const enableDiscreteEventMicroTasks = false; export const enableNativeEventPriorityInference = false; diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index 9d160790b3fec..a6482da52d524 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -56,7 +56,6 @@ export const enableUseRefAccessWarning = false; export const enableRecursiveCommitTraversal = false; export const disableSchedulerTimeoutInWorkLoop = false; -export const enableNonInterruptingNormalPri = false; export const enableDiscreteEventMicroTasks = false; export const enableNativeEventPriorityInference = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index 52990e5ec7b71..343bb609b4d25 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -56,7 +56,6 @@ export const enableUseRefAccessWarning = false; export const enableRecursiveCommitTraversal = false; export const disableSchedulerTimeoutInWorkLoop = false; -export const enableNonInterruptingNormalPri = false; export const enableDiscreteEventMicroTasks = false; export const enableNativeEventPriorityInference = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js index 3c739b7bccb39..e9ad4240a6fc3 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js @@ -56,7 +56,6 @@ export const enableUseRefAccessWarning = false; export const enableRecursiveCommitTraversal = false; export const disableSchedulerTimeoutInWorkLoop = false; -export const enableNonInterruptingNormalPri = false; export const enableDiscreteEventMicroTasks = false; export const enableNativeEventPriorityInference = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index fb2211763c03d..2afc959952aca 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -56,7 +56,6 @@ export const enableUseRefAccessWarning = false; export const enableRecursiveCommitTraversal = false; export const disableSchedulerTimeoutInWorkLoop = false; -export const enableNonInterruptingNormalPri = false; export const enableDiscreteEventMicroTasks = false; export const enableNativeEventPriorityInference = false; diff --git a/packages/shared/forks/ReactFeatureFlags.testing.js b/packages/shared/forks/ReactFeatureFlags.testing.js index 34e6d5315742f..d79a63c577892 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.js @@ -56,7 +56,6 @@ export const enableUseRefAccessWarning = false; export const enableRecursiveCommitTraversal = false; export const disableSchedulerTimeoutInWorkLoop = false; -export const enableNonInterruptingNormalPri = false; export const enableDiscreteEventMicroTasks = false; export const enableNativeEventPriorityInference = false; diff --git a/packages/shared/forks/ReactFeatureFlags.testing.www.js b/packages/shared/forks/ReactFeatureFlags.testing.www.js index 4f0c56733eafd..732360618f6bf 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.www.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.www.js @@ -56,7 +56,6 @@ export const enableUseRefAccessWarning = false; export const enableRecursiveCommitTraversal = false; export const disableSchedulerTimeoutInWorkLoop = false; -export const enableNonInterruptingNormalPri = false; export const enableDiscreteEventMicroTasks = false; export const enableNativeEventPriorityInference = false; diff --git a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js index b6e1d4260cc4a..daf49b2ab2255 100644 --- a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js +++ b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js @@ -55,6 +55,5 @@ export const enableUseRefAccessWarning = __VARIANT__; export const enableProfilerNestedUpdateScheduledHook = __VARIANT__; export const disableSchedulerTimeoutInWorkLoop = __VARIANT__; -export const enableNonInterruptingNormalPri = __VARIANT__; export const enableDiscreteEventMicroTasks = __VARIANT__; export const enableNativeEventPriorityInference = __VARIANT__; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index 924fd6ea9e5bd..2d983a3e8f81d 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -31,7 +31,6 @@ export const { enableUseRefAccessWarning, disableNativeComponentFrames, disableSchedulerTimeoutInWorkLoop, - enableNonInterruptingNormalPri, enableDiscreteEventMicroTasks, enableNativeEventPriorityInference, } = dynamicFeatureFlags;