Skip to content

Commit 0717641

Browse files
committed
Renaming method names from "pending work" to "pending priority"
1 parent 2ffb544 commit 0717641

File tree

2 files changed

+28
-37
lines changed

2 files changed

+28
-37
lines changed

packages/react-reconciler/src/ReactFiberPendingPriority.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {enableSuspense} from 'shared/ReactFeatureFlags';
1616

1717
// TODO: Offscreen updates
1818

19-
export function addPendingWork(
19+
export function addPendingPriorityLevel(
2020
root: FiberRoot,
2121
expirationTime: ExpirationTime,
2222
): void {
@@ -41,7 +41,7 @@ export function addPendingWork(
4141
}
4242
}
4343

44-
export function flushPendingWork(
44+
export function flushPendingPriorityLevel(
4545
root: FiberRoot,
4646
currentTime: ExpirationTime,
4747
earliestRemainingTime: ExpirationTime,
@@ -81,7 +81,7 @@ export function flushPendingWork(
8181
if (earliestSuspendedTime === NoWork) {
8282
// There's no suspended work. Treat the earliest remaining level as a
8383
// pending level.
84-
addPendingWork(root, earliestRemainingTime);
84+
addPendingPriorityLevel(root, earliestRemainingTime);
8585
return;
8686
}
8787

@@ -95,14 +95,14 @@ export function flushPendingWork(
9595

9696
// There's no suspended work. Treat the earliest remaining level as a
9797
// pending level.
98-
addPendingWork(root, earliestRemainingTime);
98+
addPendingPriorityLevel(root, earliestRemainingTime);
9999
return;
100100
}
101101

102102
if (earliestRemainingTime < earliestSuspendedTime) {
103103
// The earliest remaining time is earlier than all the suspended work.
104104
// Treat it as a pending update.
105-
addPendingWork(root, earliestRemainingTime);
105+
addPendingPriorityLevel(root, earliestRemainingTime);
106106
return;
107107
}
108108

@@ -111,7 +111,7 @@ export function flushPendingWork(
111111
}
112112
}
113113

114-
export function suspendPendingWork(
114+
export function suspendPriorityLevel(
115115
root: FiberRoot,
116116
suspendedTime: ExpirationTime,
117117
): void {
@@ -157,7 +157,7 @@ export function suspendPendingWork(
157157
}
158158
}
159159

160-
export function resumePendingWork(
160+
export function resumePriorityLevel(
161161
root: FiberRoot,
162162
pingedTime: ExpirationTime,
163163
): void {
@@ -187,9 +187,7 @@ export function resumePendingWork(
187187
}
188188
}
189189

190-
export function findNextExpirationTimeToWorkOn(
191-
root: FiberRoot,
192-
): ExpirationTime {
190+
export function findNextPendingPriorityLevel(root: FiberRoot): ExpirationTime {
193191
if (enableSuspense) {
194192
const earliestSuspendedTime = root.earliestSuspendedTime;
195193
const earliestPendingTime = root.earliestPendingTime;

packages/react-reconciler/src/ReactFiberScheduler.js

+20-27
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ import ReactFiberHydrationContext from './ReactFiberHydrationContext';
5858
import ReactFiberInstrumentation from './ReactFiberInstrumentation';
5959
import ReactDebugCurrentFiber from './ReactDebugCurrentFiber';
6060
import {
61-
addPendingWork,
62-
flushPendingWork,
63-
findNextExpirationTimeToWorkOn,
64-
suspendPendingWork,
65-
resumePendingWork,
61+
addPendingPriorityLevel,
62+
flushPendingPriorityLevel,
63+
findNextPendingPriorityLevel,
64+
suspendPriorityLevel,
65+
resumePriorityLevel,
6666
} from './ReactFiberPendingPriority';
6767
import {
6868
recordEffect,
@@ -260,7 +260,7 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
260260
let nextRoot: FiberRoot | null = null;
261261
// The time at which we're currently rendering work.
262262
let nextRenderExpirationTime: ExpirationTime = NoWork;
263-
let nextEarliestTimeoutMs: number = -1;
263+
let nextLatestTimeoutMs: number = -1;
264264
let nextRenderIsExpired: boolean = false;
265265

266266
// The next fiber with an effect that we're currently committing.
@@ -358,7 +358,7 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
358358

359359
nextRoot = null;
360360
nextRenderExpirationTime = NoWork;
361-
nextEarliestTimeoutMs = -1;
361+
nextLatestTimeoutMs = -1;
362362
nextRenderIsExpired = false;
363363
nextUnitOfWork = null;
364364

@@ -684,8 +684,8 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
684684
ReactFiberInstrumentation.debugTool.onCommitWork(finishedWork);
685685
}
686686

687-
flushPendingWork(root, currentTime, root.current.expirationTime);
688-
const remainingTime = findNextExpirationTimeToWorkOn(root);
687+
flushPendingPriorityLevel(root, currentTime, root.current.expirationTime);
688+
const remainingTime = findNextPendingPriorityLevel(root);
689689
if (remainingTime === NoWork) {
690690
// If there's no remaining work, we can clear the set of already failed
691691
// error boundaries.
@@ -970,7 +970,7 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
970970
resetStack();
971971
nextRoot = root;
972972
nextRenderExpirationTime = expirationTime;
973-
nextEarliestTimeoutMs = -1;
973+
nextLatestTimeoutMs = -1;
974974
nextUnitOfWork = createWorkInProgress(
975975
nextRoot.current,
976976
null,
@@ -1067,15 +1067,13 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
10671067
'Expired work should have completed. This error is likely caused ' +
10681068
'by a bug in React. Please file an issue.',
10691069
);
1070-
suspendPendingWork(root, expirationTime);
1071-
if (nextEarliestTimeoutMs >= 0) {
1070+
suspendPriorityLevel(root, expirationTime);
1071+
if (nextLatestTimeoutMs >= 0) {
10721072
setTimeout(() => {
10731073
retrySuspendedRoot(root, expirationTime);
1074-
}, nextEarliestTimeoutMs);
1074+
}, nextLatestTimeoutMs);
10751075
}
1076-
const firstUnblockedExpirationTime = findNextExpirationTimeToWorkOn(
1077-
root,
1078-
);
1076+
const firstUnblockedExpirationTime = findNextPendingPriorityLevel(root);
10791077
onBlock(firstUnblockedExpirationTime);
10801078
return null;
10811079
}
@@ -1254,17 +1252,14 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
12541252
suspendedTime: ExpirationTime,
12551253
) {
12561254
// Schedule the timeout.
1257-
if (
1258-
timeoutMs >= 0 &&
1259-
(nextEarliestTimeoutMs === -1 || timeoutMs < nextEarliestTimeoutMs)
1260-
) {
1261-
nextEarliestTimeoutMs = timeoutMs;
1255+
if (timeoutMs >= 0 && nextLatestTimeoutMs < timeoutMs) {
1256+
nextLatestTimeoutMs = timeoutMs;
12621257
}
12631258
}
12641259

12651260
function retrySuspendedRoot(root, suspendedTime) {
1266-
resumePendingWork(root, suspendedTime);
1267-
const retryTime = findNextExpirationTimeToWorkOn(root);
1261+
resumePriorityLevel(root, suspendedTime);
1262+
const retryTime = findNextPendingPriorityLevel(root);
12681263
if (retryTime !== NoWork) {
12691264
requestRetry(root, retryTime);
12701265
}
@@ -1310,10 +1305,8 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
13101305
interruptedBy = fiber;
13111306
resetStack();
13121307
}
1313-
addPendingWork(root, expirationTime);
1314-
const nextExpirationTimeToWorkOn = findNextExpirationTimeToWorkOn(
1315-
root,
1316-
);
1308+
addPendingPriorityLevel(root, expirationTime);
1309+
const nextExpirationTimeToWorkOn = findNextPendingPriorityLevel(root);
13171310
if (
13181311
// If we're in the render phase, we don't need to schedule this root
13191312
// for an update, because we'll do it before we exit...

0 commit comments

Comments
 (0)