Skip to content

Commit

Permalink
Land enableNonInterruptingNormalPri
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Feb 22, 2021
1 parent 8af27ae commit 1a7d9ae
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 49 deletions.
8 changes: 2 additions & 6 deletions packages/react-reconciler/src/ReactFiberLane.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ export type Lane = number;
export type LaneMap<T> = Array<T>;

import invariant from 'shared/invariant';
import {
enableCache,
enableNonInterruptingNormalPri,
} from 'shared/ReactFeatureFlags';
import {enableCache} from 'shared/ReactFeatureFlags';

import {
ImmediatePriority as ImmediateSchedulerPriority,
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 2 additions & 6 deletions packages/react-reconciler/src/ReactFiberLane.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ export type Lane = number;
export type LaneMap<T> = Array<T>;

import invariant from 'shared/invariant';
import {
enableCache,
enableNonInterruptingNormalPri,
} from 'shared/ReactFeatureFlags';
import {enableCache} from 'shared/ReactFeatureFlags';

import {
ImmediatePriority as ImmediateSchedulerPriority,
Expand Down Expand Up @@ -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.
Expand Down
36 changes: 10 additions & 26 deletions packages/react-reconciler/src/__tests__/ReactTransition-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
2 changes: 0 additions & 2 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ export const enableRecursiveCommitTraversal = false;

export const disableSchedulerTimeoutInWorkLoop = false;

export const enableNonInterruptingNormalPri = false;

export const enableDiscreteEventMicroTasks = false;

export const enableNativeEventPriorityInference = false;
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.test-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.testing.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.www-dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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__;
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const {
enableUseRefAccessWarning,
disableNativeComponentFrames,
disableSchedulerTimeoutInWorkLoop,
enableNonInterruptingNormalPri,
enableDiscreteEventMicroTasks,
enableNativeEventPriorityInference,
} = dynamicFeatureFlags;
Expand Down

0 comments on commit 1a7d9ae

Please sign in to comment.