Skip to content

Commit 1df1b3e

Browse files
committed
Delete LanePriority type (facebook#21090)
No longer using LanePriority anywhere, so this deletes the remaining references.
1 parent ffc8919 commit 1df1b3e

File tree

2 files changed

+4
-120
lines changed

2 files changed

+4
-120
lines changed

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

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,6 @@ export type LaneMap<T> = Array<T>;
3737

3838
import {enableCache, enableSchedulingProfiler} from 'shared/ReactFeatureFlags';
3939

40-
export const SyncLanePriority: LanePriority = 12;
41-
42-
const InputContinuousHydrationLanePriority: LanePriority = 11;
43-
export const InputContinuousLanePriority: LanePriority = 10;
44-
45-
const DefaultHydrationLanePriority: LanePriority = 9;
46-
export const DefaultLanePriority: LanePriority = 8;
47-
48-
const TransitionHydrationPriority: LanePriority = 7;
49-
export const TransitionPriority: LanePriority = 6;
50-
51-
const RetryLanePriority: LanePriority = 5;
52-
53-
const SelectiveHydrationLanePriority: LanePriority = 4;
54-
55-
const IdleHydrationLanePriority: LanePriority = 3;
56-
export const IdleLanePriority: LanePriority = 2;
57-
58-
const OffscreenLanePriority: LanePriority = 1;
59-
60-
export const NoLanePriority: LanePriority = 0;
61-
6240
// Lane values below should be kept in sync with getLabelsForLanes(), used by react-devtools-scheduling-profiler.
6341
// If those values are changed that package should be rebuilt and redeployed.
6442

@@ -162,29 +140,19 @@ export const NoTimestamp = -1;
162140
let nextTransitionLane: Lane = TransitionLane1;
163141
let nextRetryLane: Lane = RetryLane1;
164142

165-
// "Registers" used to "return" multiple values
166-
// Used by getHighestPriorityLanes and getNextLanes:
167-
let return_highestLanePriority: LanePriority = DefaultLanePriority;
168-
169143
function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
170144
switch (getHighestPriorityLane(lanes)) {
171145
case SyncLane:
172-
return_highestLanePriority = SyncLanePriority;
173146
return SyncLane;
174147
case InputContinuousHydrationLane:
175-
return_highestLanePriority = InputContinuousHydrationLanePriority;
176148
return InputContinuousHydrationLane;
177149
case InputContinuousLane:
178-
return_highestLanePriority = InputContinuousLanePriority;
179150
return InputContinuousLane;
180151
case DefaultHydrationLane:
181-
return_highestLanePriority = DefaultHydrationLanePriority;
182152
return DefaultHydrationLane;
183153
case DefaultLane:
184-
return_highestLanePriority = DefaultLanePriority;
185154
return DefaultLane;
186155
case TransitionHydrationLane:
187-
return_highestLanePriority = TransitionHydrationPriority;
188156
return TransitionHydrationLane;
189157
case TransitionLane1:
190158
case TransitionLane2:
@@ -202,26 +170,20 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
202170
case TransitionLane14:
203171
case TransitionLane15:
204172
case TransitionLane16:
205-
return_highestLanePriority = TransitionPriority;
206173
return lanes & TransitionLanes;
207174
case RetryLane1:
208175
case RetryLane2:
209176
case RetryLane3:
210177
case RetryLane4:
211178
case RetryLane5:
212-
return_highestLanePriority = RetryLanePriority;
213179
return lanes & RetryLanes;
214180
case SelectiveHydrationLane:
215-
return_highestLanePriority = SelectiveHydrationLanePriority;
216181
return SelectiveHydrationLane;
217182
case IdleHydrationLane:
218-
return_highestLanePriority = IdleHydrationLanePriority;
219183
return IdleHydrationLane;
220184
case IdleLane:
221-
return_highestLanePriority = IdleLanePriority;
222185
return IdleLane;
223186
case OffscreenLane:
224-
return_highestLanePriority = OffscreenLanePriority;
225187
return OffscreenLane;
226188
default:
227189
if (__DEV__) {
@@ -230,7 +192,6 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
230192
);
231193
}
232194
// This shouldn't be reachable, but as a fallback, return the entire bitmask.
233-
return_highestLanePriority = DefaultLanePriority;
234195
return lanes;
235196
}
236197
}
@@ -239,48 +200,41 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
239200
// Early bailout if there's no pending work left.
240201
const pendingLanes = root.pendingLanes;
241202
if (pendingLanes === NoLanes) {
242-
return_highestLanePriority = NoLanePriority;
243203
return NoLanes;
244204
}
245205

246206
let nextLanes = NoLanes;
247-
let nextLanePriority = NoLanePriority;
248207

249208
const expiredLanes = root.expiredLanes;
250209
const suspendedLanes = root.suspendedLanes;
251210
const pingedLanes = root.pingedLanes;
252211

212+
// Do not work on any idle work until all the non-idle work has finished,
213+
// even if the work is suspended.
253214
// Check if any work has expired.
254215
if (expiredLanes !== NoLanes) {
255216
// TODO: Should entangle with SyncLane
256217
nextLanes = expiredLanes;
257-
nextLanePriority = return_highestLanePriority = SyncLanePriority;
258218
} else {
259-
// Do not work on any idle work until all the non-idle work has finished,
260-
// even if the work is suspended.
261219
const nonIdlePendingLanes = pendingLanes & NonIdleLanes;
262220
if (nonIdlePendingLanes !== NoLanes) {
263221
const nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes;
264222
if (nonIdleUnblockedLanes !== NoLanes) {
265223
nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes);
266-
nextLanePriority = return_highestLanePriority;
267224
} else {
268225
const nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes;
269226
if (nonIdlePingedLanes !== NoLanes) {
270227
nextLanes = getHighestPriorityLanes(nonIdlePingedLanes);
271-
nextLanePriority = return_highestLanePriority;
272228
}
273229
}
274230
} else {
275231
// The only remaining work is Idle.
276232
const unblockedLanes = pendingLanes & ~suspendedLanes;
277233
if (unblockedLanes !== NoLanes) {
278234
nextLanes = getHighestPriorityLanes(unblockedLanes);
279-
nextLanePriority = return_highestLanePriority;
280235
} else {
281236
if (pingedLanes !== NoLanes) {
282237
nextLanes = getHighestPriorityLanes(pingedLanes);
283-
nextLanePriority = return_highestLanePriority;
284238
}
285239
}
286240
}
@@ -315,8 +269,6 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
315269
) {
316270
// Keep working on the existing in-progress tree. Do not interrupt.
317271
return wipLanes;
318-
} else {
319-
return_highestLanePriority = nextLanePriority;
320272
}
321273
}
322274

@@ -493,9 +445,6 @@ export function getLanesToRetrySynchronouslyOnError(root: FiberRoot): Lanes {
493445
return NoLanes;
494446
}
495447

496-
export function returnNextLanesPriority() {
497-
return return_highestLanePriority;
498-
}
499448
export function includesNonIdleWork(lanes: Lanes) {
500449
return (lanes & NonIdleLanes) !== NoLanes;
501450
}
@@ -582,13 +531,6 @@ export function higherPriorityLane(a: Lane, b: Lane) {
582531
return a !== NoLane && a < b ? a : b;
583532
}
584533

585-
export function higherLanePriority(
586-
a: LanePriority,
587-
b: LanePriority,
588-
): LanePriority {
589-
return a !== NoLanePriority && a > b ? a : b;
590-
}
591-
592534
export function createLaneMap<T>(initial: T): LaneMap<T> {
593535
// Intentionally pushing one by one.
594536
// https://v8.dev/blog/elements-kinds#avoid-creating-holes

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

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,6 @@ export type LaneMap<T> = Array<T>;
3737

3838
import {enableCache, enableSchedulingProfiler} from 'shared/ReactFeatureFlags';
3939

40-
export const SyncLanePriority: LanePriority = 12;
41-
42-
const InputContinuousHydrationLanePriority: LanePriority = 11;
43-
export const InputContinuousLanePriority: LanePriority = 10;
44-
45-
const DefaultHydrationLanePriority: LanePriority = 9;
46-
export const DefaultLanePriority: LanePriority = 8;
47-
48-
const TransitionHydrationPriority: LanePriority = 7;
49-
export const TransitionPriority: LanePriority = 6;
50-
51-
const RetryLanePriority: LanePriority = 5;
52-
53-
const SelectiveHydrationLanePriority: LanePriority = 4;
54-
55-
const IdleHydrationLanePriority: LanePriority = 3;
56-
export const IdleLanePriority: LanePriority = 2;
57-
58-
const OffscreenLanePriority: LanePriority = 1;
59-
60-
export const NoLanePriority: LanePriority = 0;
61-
6240
// Lane values below should be kept in sync with getLabelsForLanes(), used by react-devtools-scheduling-profiler.
6341
// If those values are changed that package should be rebuilt and redeployed.
6442

@@ -162,29 +140,19 @@ export const NoTimestamp = -1;
162140
let nextTransitionLane: Lane = TransitionLane1;
163141
let nextRetryLane: Lane = RetryLane1;
164142

165-
// "Registers" used to "return" multiple values
166-
// Used by getHighestPriorityLanes and getNextLanes:
167-
let return_highestLanePriority: LanePriority = DefaultLanePriority;
168-
169143
function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
170144
switch (getHighestPriorityLane(lanes)) {
171145
case SyncLane:
172-
return_highestLanePriority = SyncLanePriority;
173146
return SyncLane;
174147
case InputContinuousHydrationLane:
175-
return_highestLanePriority = InputContinuousHydrationLanePriority;
176148
return InputContinuousHydrationLane;
177149
case InputContinuousLane:
178-
return_highestLanePriority = InputContinuousLanePriority;
179150
return InputContinuousLane;
180151
case DefaultHydrationLane:
181-
return_highestLanePriority = DefaultHydrationLanePriority;
182152
return DefaultHydrationLane;
183153
case DefaultLane:
184-
return_highestLanePriority = DefaultLanePriority;
185154
return DefaultLane;
186155
case TransitionHydrationLane:
187-
return_highestLanePriority = TransitionHydrationPriority;
188156
return TransitionHydrationLane;
189157
case TransitionLane1:
190158
case TransitionLane2:
@@ -202,26 +170,20 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
202170
case TransitionLane14:
203171
case TransitionLane15:
204172
case TransitionLane16:
205-
return_highestLanePriority = TransitionPriority;
206173
return lanes & TransitionLanes;
207174
case RetryLane1:
208175
case RetryLane2:
209176
case RetryLane3:
210177
case RetryLane4:
211178
case RetryLane5:
212-
return_highestLanePriority = RetryLanePriority;
213179
return lanes & RetryLanes;
214180
case SelectiveHydrationLane:
215-
return_highestLanePriority = SelectiveHydrationLanePriority;
216181
return SelectiveHydrationLane;
217182
case IdleHydrationLane:
218-
return_highestLanePriority = IdleHydrationLanePriority;
219183
return IdleHydrationLane;
220184
case IdleLane:
221-
return_highestLanePriority = IdleLanePriority;
222185
return IdleLane;
223186
case OffscreenLane:
224-
return_highestLanePriority = OffscreenLanePriority;
225187
return OffscreenLane;
226188
default:
227189
if (__DEV__) {
@@ -230,7 +192,6 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
230192
);
231193
}
232194
// This shouldn't be reachable, but as a fallback, return the entire bitmask.
233-
return_highestLanePriority = DefaultLanePriority;
234195
return lanes;
235196
}
236197
}
@@ -239,48 +200,41 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
239200
// Early bailout if there's no pending work left.
240201
const pendingLanes = root.pendingLanes;
241202
if (pendingLanes === NoLanes) {
242-
return_highestLanePriority = NoLanePriority;
243203
return NoLanes;
244204
}
245205

246206
let nextLanes = NoLanes;
247-
let nextLanePriority = NoLanePriority;
248207

249208
const expiredLanes = root.expiredLanes;
250209
const suspendedLanes = root.suspendedLanes;
251210
const pingedLanes = root.pingedLanes;
252211

212+
// Do not work on any idle work until all the non-idle work has finished,
213+
// even if the work is suspended.
253214
// Check if any work has expired.
254215
if (expiredLanes !== NoLanes) {
255216
// TODO: Should entangle with SyncLane
256217
nextLanes = expiredLanes;
257-
nextLanePriority = return_highestLanePriority = SyncLanePriority;
258218
} else {
259-
// Do not work on any idle work until all the non-idle work has finished,
260-
// even if the work is suspended.
261219
const nonIdlePendingLanes = pendingLanes & NonIdleLanes;
262220
if (nonIdlePendingLanes !== NoLanes) {
263221
const nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes;
264222
if (nonIdleUnblockedLanes !== NoLanes) {
265223
nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes);
266-
nextLanePriority = return_highestLanePriority;
267224
} else {
268225
const nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes;
269226
if (nonIdlePingedLanes !== NoLanes) {
270227
nextLanes = getHighestPriorityLanes(nonIdlePingedLanes);
271-
nextLanePriority = return_highestLanePriority;
272228
}
273229
}
274230
} else {
275231
// The only remaining work is Idle.
276232
const unblockedLanes = pendingLanes & ~suspendedLanes;
277233
if (unblockedLanes !== NoLanes) {
278234
nextLanes = getHighestPriorityLanes(unblockedLanes);
279-
nextLanePriority = return_highestLanePriority;
280235
} else {
281236
if (pingedLanes !== NoLanes) {
282237
nextLanes = getHighestPriorityLanes(pingedLanes);
283-
nextLanePriority = return_highestLanePriority;
284238
}
285239
}
286240
}
@@ -315,8 +269,6 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
315269
) {
316270
// Keep working on the existing in-progress tree. Do not interrupt.
317271
return wipLanes;
318-
} else {
319-
return_highestLanePriority = nextLanePriority;
320272
}
321273
}
322274

@@ -493,9 +445,6 @@ export function getLanesToRetrySynchronouslyOnError(root: FiberRoot): Lanes {
493445
return NoLanes;
494446
}
495447

496-
export function returnNextLanesPriority() {
497-
return return_highestLanePriority;
498-
}
499448
export function includesNonIdleWork(lanes: Lanes) {
500449
return (lanes & NonIdleLanes) !== NoLanes;
501450
}
@@ -582,13 +531,6 @@ export function higherPriorityLane(a: Lane, b: Lane) {
582531
return a !== NoLane && a < b ? a : b;
583532
}
584533

585-
export function higherLanePriority(
586-
a: LanePriority,
587-
b: LanePriority,
588-
): LanePriority {
589-
return a !== NoLanePriority && a > b ? a : b;
590-
}
591-
592534
export function createLaneMap<T>(initial: T): LaneMap<T> {
593535
// Intentionally pushing one by one.
594536
// https://v8.dev/blog/elements-kinds#avoid-creating-holes

0 commit comments

Comments
 (0)