Skip to content

Commit

Permalink
Change feature flag and gate test
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Feb 9, 2021
1 parent d10b5db commit bddba72
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 12 deletions.
3 changes: 2 additions & 1 deletion packages/react-reconciler/src/ReactFiberLane.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import invariant from 'shared/invariant';
import {
enableCache,
enableTransitionEntanglement,
enableNonInterruptingNormalPri,
} from 'shared/ReactFeatureFlags';

import {
Expand Down Expand Up @@ -331,7 +332,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.
(enableTransitionEntanglement &&
(enableNonInterruptingNormalPri &&
nextLanePriority === DefaultLanePriority &&
wipLanePriority === TransitionPriority)
) {
Expand Down
3 changes: 2 additions & 1 deletion packages/react-reconciler/src/ReactFiberLane.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import invariant from 'shared/invariant';
import {
enableCache,
enableTransitionEntanglement,
enableNonInterruptingNormalPri,
} from 'shared/ReactFeatureFlags';

import {
Expand Down Expand Up @@ -331,7 +332,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.
(enableTransitionEntanglement &&
(enableNonInterruptingNormalPri &&
nextLanePriority === DefaultLanePriority &&
wipLanePriority === TransitionPriority)
) {
Expand Down
37 changes: 27 additions & 10 deletions packages/react-reconciler/src/__tests__/ReactTransition-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -964,16 +964,33 @@ describe('ReactTransition', () => {
updateNormalPri();
});

expect(Scheduler).toHaveYielded([
// Finish transition update.
'Normal pri: 0',
'Commit',
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');
// 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',

// Restart transition update.
'Transition pri: 1',
'Normal pri: 1',
'Commit',
]);

expect(root).toMatchRenderedOutput('Transition pri: 1, Normal pri: 1');
}
});
});
2 changes: 2 additions & 0 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,6 @@ export const disableSchedulerTimeoutInWorkLoop = false;
// Experiment to simplify/improve how transitions are scheduled
export const enableTransitionEntanglement = false;

export const enableNonInterruptingNormalPri = false;

export const enableDiscreteEventMicroTasks = false;
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const enableUseRefAccessWarning = false;
export const enableRecursiveCommitTraversal = false;
export const disableSchedulerTimeoutInWorkLoop = false;
export const enableTransitionEntanglement = false;
export const enableNonInterruptingNormalPri = false;
export const enableDiscreteEventMicroTasks = false;

// Flow magic to verify the exports of this file match the original version.
Expand Down
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.native-oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const enableUseRefAccessWarning = false;
export const enableRecursiveCommitTraversal = false;
export const disableSchedulerTimeoutInWorkLoop = false;
export const enableTransitionEntanglement = false;
export const enableNonInterruptingNormalPri = false;
export const enableDiscreteEventMicroTasks = false;

// Flow magic to verify the exports of this file match the original version.
Expand Down
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.test-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const enableUseRefAccessWarning = false;
export const enableRecursiveCommitTraversal = false;
export const disableSchedulerTimeoutInWorkLoop = false;
export const enableTransitionEntanglement = false;
export const enableNonInterruptingNormalPri = false;
export const enableDiscreteEventMicroTasks = false;

// Flow magic to verify the exports of this file match the original version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const enableUseRefAccessWarning = false;
export const enableRecursiveCommitTraversal = false;
export const disableSchedulerTimeoutInWorkLoop = false;
export const enableTransitionEntanglement = false;
export const enableNonInterruptingNormalPri = false;
export const enableDiscreteEventMicroTasks = false;

// Flow magic to verify the exports of this file match the original version.
Expand Down
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const enableUseRefAccessWarning = false;
export const enableRecursiveCommitTraversal = false;
export const disableSchedulerTimeoutInWorkLoop = false;
export const enableTransitionEntanglement = false;
export const enableNonInterruptingNormalPri = false;
export const enableDiscreteEventMicroTasks = false;

// Flow magic to verify the exports of this file match the original version.
Expand Down
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.testing.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const enableUseRefAccessWarning = false;
export const enableRecursiveCommitTraversal = false;
export const disableSchedulerTimeoutInWorkLoop = false;
export const enableTransitionEntanglement = false;
export const enableNonInterruptingNormalPri = false;
export const enableDiscreteEventMicroTasks = false;

// Flow magic to verify the exports of this file match the original version.
Expand Down
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.www-dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ export const enableUseRefAccessWarning = __VARIANT__;
export const enableProfilerNestedUpdateScheduledHook = __VARIANT__;
export const disableSchedulerTimeoutInWorkLoop = __VARIANT__;
export const enableTransitionEntanglement = __VARIANT__;
export const enableNonInterruptingNormalPri = __VARIANT__;
export const enableDiscreteEventMicroTasks = __VARIANT__;
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const {
disableNativeComponentFrames,
disableSchedulerTimeoutInWorkLoop,
enableTransitionEntanglement,
enableNonInterruptingNormalPri,
enableDiscreteEventMicroTasks,
} = dynamicFeatureFlags;

Expand Down

0 comments on commit bddba72

Please sign in to comment.