Skip to content

Commit 9e06824

Browse files
committed
Land enableNativeEventPriorityInference
1 parent 73e900b commit 9e06824

16 files changed

+10
-133
lines changed

packages/react-dom/src/__tests__/ReactDOMNativeEventHeuristic-test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ describe('ReactDOMNativeEventHeuristic-test', () => {
4343
}
4444

4545
// @gate experimental
46-
// @gate enableNativeEventPriorityInference
4746
it('ignores discrete events on a pending removed element', async () => {
4847
const disableButtonRef = React.createRef();
4948
const submitButtonRef = React.createRef();
@@ -95,7 +94,6 @@ describe('ReactDOMNativeEventHeuristic-test', () => {
9594
});
9695

9796
// @gate experimental
98-
// @gate enableNativeEventPriorityInference
9997
it('ignores discrete events on a pending removed event listener', async () => {
10098
const disableButtonRef = React.createRef();
10199
const submitButtonRef = React.createRef();
@@ -165,7 +163,6 @@ describe('ReactDOMNativeEventHeuristic-test', () => {
165163
});
166164

167165
// @gate experimental
168-
// @gate enableNativeEventPriorityInference
169166
it('uses the newest discrete events on a pending changed event listener', async () => {
170167
const enableButtonRef = React.createRef();
171168
const submitButtonRef = React.createRef();
@@ -229,7 +226,6 @@ describe('ReactDOMNativeEventHeuristic-test', () => {
229226
});
230227

231228
// @gate experimental
232-
// @gate enableNativeEventPriorityInference
233229
it('mouse over should be user-blocking but not discrete', async () => {
234230
const root = ReactDOM.unstable_createRoot(container);
235231

@@ -260,7 +256,6 @@ describe('ReactDOMNativeEventHeuristic-test', () => {
260256
});
261257

262258
// @gate experimental
263-
// @gate enableNativeEventPriorityInference
264259
it('mouse enter should be user-blocking but not discrete', async () => {
265260
const root = ReactDOM.unstable_createRoot(container);
266261

packages/react-noop-renderer/src/createReactNoop.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
LegacyRoot,
2828
} from 'react-reconciler/src/ReactRootTags';
2929

30-
import {enableNativeEventPriorityInference} from 'shared/ReactFeatureFlags';
3130
import ReactSharedInternals from 'shared/ReactSharedInternals';
3231
import enqueueTask from 'shared/enqueueTask';
3332
const {IsSomeRendererActing} = ReactSharedInternals;
@@ -934,19 +933,12 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
934933
discreteUpdates: NoopRenderer.discreteUpdates,
935934

936935
idleUpdates<T>(fn: () => T): T {
937-
if (enableNativeEventPriorityInference) {
938-
const prevEventPriority = currentEventPriority;
939-
currentEventPriority = NoopRenderer.IdleEventPriority;
940-
try {
941-
fn();
942-
} finally {
943-
currentEventPriority = prevEventPriority;
944-
}
945-
} else {
946-
return Scheduler.unstable_runWithPriority(
947-
Scheduler.unstable_IdlePriority,
948-
fn,
949-
);
936+
const prevEventPriority = currentEventPriority;
937+
currentEventPriority = NoopRenderer.IdleEventPriority;
938+
try {
939+
fn();
940+
} finally {
941+
currentEventPriority = prevEventPriority;
950942
}
951943
},
952944

packages/react-reconciler/src/ReactFiberWorkLoop.new.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import {
3232
disableSchedulerTimeoutInWorkLoop,
3333
enableStrictEffects,
3434
skipUnmountedBoundaries,
35-
enableNativeEventPriorityInference,
3635
} from 'shared/ReactFeatureFlags';
3736
import ReactSharedInternals from 'shared/ReactSharedInternals';
3837
import invariant from 'shared/invariant';
@@ -456,15 +455,8 @@ export function requestUpdateLane(fiber: Fiber): Lane {
456455
const currentLanePriority = getCurrentUpdateLanePriority();
457456
lane = findUpdateLane(currentLanePriority);
458457
} else {
459-
if (enableNativeEventPriorityInference) {
460-
const eventLanePriority = getCurrentEventPriority();
461-
lane = findUpdateLane(eventLanePriority);
462-
} else {
463-
const schedulerLanePriority = schedulerPriorityToLanePriority(
464-
schedulerPriority,
465-
);
466-
lane = findUpdateLane(schedulerLanePriority);
467-
}
458+
const eventLanePriority = getCurrentEventPriority();
459+
lane = findUpdateLane(eventLanePriority);
468460
}
469461

470462
return lane;

packages/react-reconciler/src/ReactFiberWorkLoop.old.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import {
3232
disableSchedulerTimeoutInWorkLoop,
3333
enableStrictEffects,
3434
skipUnmountedBoundaries,
35-
enableNativeEventPriorityInference,
3635
} from 'shared/ReactFeatureFlags';
3736
import ReactSharedInternals from 'shared/ReactSharedInternals';
3837
import invariant from 'shared/invariant';
@@ -456,15 +455,8 @@ export function requestUpdateLane(fiber: Fiber): Lane {
456455
const currentLanePriority = getCurrentUpdateLanePriority();
457456
lane = findUpdateLane(currentLanePriority);
458457
} else {
459-
if (enableNativeEventPriorityInference) {
460-
const eventLanePriority = getCurrentEventPriority();
461-
lane = findUpdateLane(eventLanePriority);
462-
} else {
463-
const schedulerLanePriority = schedulerPriorityToLanePriority(
464-
schedulerPriority,
465-
);
466-
lane = findUpdateLane(schedulerLanePriority);
467-
}
458+
const eventLanePriority = getCurrentEventPriority();
459+
lane = findUpdateLane(eventLanePriority);
468460
}
469461

470462
return lane;

packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -68,66 +68,6 @@ describe('ReactSchedulerIntegration', () => {
6868
);
6969
}
7070

71-
// TODO: Figure out what to do with these tests. I don't think most of them
72-
// make sense once we decouple Scheduler from React. Perhaps need similar
73-
// tests for React DOM.
74-
// @gate !enableNativeEventPriorityInference
75-
it('has correct priority during rendering', () => {
76-
function ReadPriority() {
77-
Scheduler.unstable_yieldValue(
78-
'Priority: ' + getCurrentPriorityAsString(),
79-
);
80-
return null;
81-
}
82-
ReactNoop.render(<ReadPriority />);
83-
expect(Scheduler).toFlushAndYield(['Priority: Normal']);
84-
85-
runWithPriority(UserBlockingPriority, () => {
86-
ReactNoop.render(<ReadPriority />);
87-
});
88-
expect(Scheduler).toFlushAndYield(['Priority: UserBlocking']);
89-
90-
runWithPriority(IdlePriority, () => {
91-
ReactNoop.render(<ReadPriority />);
92-
});
93-
expect(Scheduler).toFlushAndYield(['Priority: Idle']);
94-
});
95-
96-
// TODO: Figure out what to do with these tests. I don't think most of them
97-
// make sense once we decouple Scheduler from React. Perhaps need similar
98-
// tests for React DOM.
99-
// @gate !enableNativeEventPriorityInference
100-
it('has correct priority when continuing a render after yielding', () => {
101-
function ReadPriority() {
102-
Scheduler.unstable_yieldValue(
103-
'Priority: ' + getCurrentPriorityAsString(),
104-
);
105-
return null;
106-
}
107-
108-
runWithPriority(UserBlockingPriority, () => {
109-
ReactNoop.render(
110-
<>
111-
<ReadPriority />
112-
<ReadPriority />
113-
<ReadPriority />
114-
</>,
115-
);
116-
});
117-
118-
// Render part of the tree
119-
expect(Scheduler).toFlushAndYieldThrough(['Priority: UserBlocking']);
120-
121-
// Priority is set back to normal when yielding
122-
expect(getCurrentPriorityAsString()).toEqual('Normal');
123-
124-
// Priority is restored to user-blocking when continuing
125-
expect(Scheduler).toFlushAndYield([
126-
'Priority: UserBlocking',
127-
'Priority: UserBlocking',
128-
]);
129-
});
130-
13171
it('passive effects are called before Normal-pri scheduled in layout effects', async () => {
13272
const {useEffect, useLayoutEffect} = React;
13373
function Effects({step}) {
@@ -172,28 +112,6 @@ describe('ReactSchedulerIntegration', () => {
172112
]);
173113
});
174114

175-
// TODO: Figure out what to do with these tests. I don't think most of them
176-
// make sense once we decouple Scheduler from React. Perhaps need similar
177-
// tests for React DOM.
178-
// @gate !enableNativeEventPriorityInference
179-
it('after completing a level of work, infers priority of the next batch based on its expiration time', () => {
180-
function App({label}) {
181-
Scheduler.unstable_yieldValue(
182-
`${label} [${getCurrentPriorityAsString()}]`,
183-
);
184-
return label;
185-
}
186-
187-
// Schedule two separate updates at different priorities
188-
runWithPriority(UserBlockingPriority, () => {
189-
ReactNoop.render(<App label="A" />);
190-
});
191-
ReactNoop.render(<App label="B" />);
192-
193-
// The second update should run at normal priority
194-
expect(Scheduler).toFlushAndYield(['A [UserBlocking]', 'B [Normal]']);
195-
});
196-
197115
it('requests a paint after committing', () => {
198116
const scheduleCallback = Scheduler.unstable_scheduleCallback;
199117

packages/react-reconciler/src/__tests__/useMutableSourceHydration-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ describe('useMutableSourceHydration', () => {
341341
});
342342

343343
// @gate experimental
344-
// @gate enableNativeEventPriorityInference
345344
it('should detect a tear during a higher priority interruption', () => {
346345
const source = createSource('one');
347346
const mutableSource = createMutableSource(source, param => param.version);

packages/shared/ReactFeatureFlags.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,4 @@ export const disableSchedulerTimeoutInWorkLoop = false;
152152

153153
export const enableSyncMicroTasks = false;
154154

155-
export const enableNativeEventPriorityInference = false;
156-
157155
export const enableLazyContextPropagation = false;

packages/shared/forks/ReactFeatureFlags.native-fb.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ export const enableUseRefAccessWarning = false;
5858
export const enableRecursiveCommitTraversal = false;
5959
export const disableSchedulerTimeoutInWorkLoop = false;
6060
export const enableSyncMicroTasks = false;
61-
export const enableNativeEventPriorityInference = false;
6261
export const enableLazyContextPropagation = false;
6362

6463
// Flow magic to verify the exports of this file match the original version.

packages/shared/forks/ReactFeatureFlags.native-oss.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export const enableUseRefAccessWarning = false;
5757
export const enableRecursiveCommitTraversal = false;
5858
export const disableSchedulerTimeoutInWorkLoop = false;
5959
export const enableSyncMicroTasks = false;
60-
export const enableNativeEventPriorityInference = false;
6160
export const enableLazyContextPropagation = false;
6261

6362
// Flow magic to verify the exports of this file match the original version.

packages/shared/forks/ReactFeatureFlags.test-renderer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export const enableUseRefAccessWarning = false;
5757
export const enableRecursiveCommitTraversal = false;
5858
export const disableSchedulerTimeoutInWorkLoop = false;
5959
export const enableSyncMicroTasks = false;
60-
export const enableNativeEventPriorityInference = false;
6160
export const enableLazyContextPropagation = false;
6261

6362
// Flow magic to verify the exports of this file match the original version.

0 commit comments

Comments
 (0)