Skip to content

Commit 1eaafc9

Browse files
authored
Clean up timeoutMs-related implementation details (#19704)
* Disable busyDelayMs and busyMinDurationMs Refer to explanation in previous commit. * Remove unnecessary work loop variables Since we no longer support SuspenseConfig options, we don't need to track these values. * Remove unnecessary Update fields
1 parent 8da0da0 commit 1eaafc9

17 files changed

+25
-411
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ const classComponentUpdater = {
199199
const suspenseConfig = requestCurrentSuspenseConfig();
200200
const lane = requestUpdateLane(fiber, suspenseConfig);
201201

202-
const update = createUpdate(eventTime, lane, suspenseConfig);
202+
const update = createUpdate(eventTime, lane);
203203
update.payload = payload;
204204
if (callback !== undefined && callback !== null) {
205205
if (__DEV__) {
@@ -230,7 +230,7 @@ const classComponentUpdater = {
230230
const suspenseConfig = requestCurrentSuspenseConfig();
231231
const lane = requestUpdateLane(fiber, suspenseConfig);
232232

233-
const update = createUpdate(eventTime, lane, suspenseConfig);
233+
const update = createUpdate(eventTime, lane);
234234
update.tag = ReplaceState;
235235
update.payload = payload;
236236

@@ -263,7 +263,7 @@ const classComponentUpdater = {
263263
const suspenseConfig = requestCurrentSuspenseConfig();
264264
const lane = requestUpdateLane(fiber, suspenseConfig);
265265

266-
const update = createUpdate(eventTime, lane, suspenseConfig);
266+
const update = createUpdate(eventTime, lane);
267267
update.tag = ForceUpdate;
268268

269269
if (callback !== undefined && callback !== null) {

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ const classComponentUpdater = {
199199
const suspenseConfig = requestCurrentSuspenseConfig();
200200
const lane = requestUpdateLane(fiber, suspenseConfig);
201201

202-
const update = createUpdate(eventTime, lane, suspenseConfig);
202+
const update = createUpdate(eventTime, lane);
203203
update.payload = payload;
204204
if (callback !== undefined && callback !== null) {
205205
if (__DEV__) {
@@ -230,7 +230,7 @@ const classComponentUpdater = {
230230
const suspenseConfig = requestCurrentSuspenseConfig();
231231
const lane = requestUpdateLane(fiber, suspenseConfig);
232232

233-
const update = createUpdate(eventTime, lane, suspenseConfig);
233+
const update = createUpdate(eventTime, lane);
234234
update.tag = ReplaceState;
235235
update.payload = payload;
236236

@@ -263,7 +263,7 @@ const classComponentUpdater = {
263263
const suspenseConfig = requestCurrentSuspenseConfig();
264264
const lane = requestUpdateLane(fiber, suspenseConfig);
265265

266-
const update = createUpdate(eventTime, lane, suspenseConfig);
266+
const update = createUpdate(eventTime, lane);
267267
update.tag = ForceUpdate;
268268

269269
if (callback !== undefined && callback !== null) {

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

-21
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ import {
6363
warnIfNotCurrentlyActingEffectsInDEV,
6464
warnIfNotCurrentlyActingUpdatesInDev,
6565
warnIfNotScopedWithMatchingAct,
66-
markRenderEventTimeAndConfig,
6766
markSkippedUpdateLanes,
6867
} from './ReactFiberWorkLoop.new';
6968

@@ -97,11 +96,7 @@ import {markStateUpdateScheduled} from './SchedulingProfiler';
9796
const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals;
9897

9998
type Update<S, A> = {|
100-
// TODO: Temporary field. Will remove this by storing a map of
101-
// transition -> start time on the root.
102-
eventTime: number,
10399
lane: Lane,
104-
suspenseConfig: null | SuspenseConfig,
105100
action: A,
106101
eagerReducer: ((S, A) => S) | null,
107102
eagerState: S | null,
@@ -715,17 +710,13 @@ function updateReducer<S, I, A>(
715710
let newBaseQueueLast = null;
716711
let update = first;
717712
do {
718-
const suspenseConfig = update.suspenseConfig;
719713
const updateLane = update.lane;
720-
const updateEventTime = update.eventTime;
721714
if (!isSubsetOfLanes(renderLanes, updateLane)) {
722715
// Priority is insufficient. Skip this update. If this is the first
723716
// skipped update, the previous update/state is the new base
724717
// update/state.
725718
const clone: Update<S, A> = {
726-
eventTime: updateEventTime,
727719
lane: updateLane,
728-
suspenseConfig: suspenseConfig,
729720
action: update.action,
730721
eagerReducer: update.eagerReducer,
731722
eagerState: update.eagerState,
@@ -750,12 +741,10 @@ function updateReducer<S, I, A>(
750741

751742
if (newBaseQueueLast !== null) {
752743
const clone: Update<S, A> = {
753-
eventTime: updateEventTime,
754744
// This update is going to be committed so we never want uncommit
755745
// it. Using NoLane works because 0 is a subset of all bitmasks, so
756746
// this will never be skipped by the check above.
757747
lane: NoLane,
758-
suspenseConfig: update.suspenseConfig,
759748
action: update.action,
760749
eagerReducer: update.eagerReducer,
761750
eagerState: update.eagerState,
@@ -764,14 +753,6 @@ function updateReducer<S, I, A>(
764753
newBaseQueueLast = newBaseQueueLast.next = clone;
765754
}
766755

767-
// Mark the event time of this update as relevant to this render pass.
768-
// TODO: This should ideally use the true event time of this update rather than
769-
// its priority which is a derived and not reverseable value.
770-
// TODO: We should skip this update if it was already committed but currently
771-
// we have no way of detecting the difference between a committed and suspended
772-
// update here.
773-
markRenderEventTimeAndConfig(updateEventTime, suspenseConfig);
774-
775756
// Process this update.
776757
if (update.eagerReducer === reducer) {
777758
// If this update was processed eagerly, and its reducer matches the
@@ -1708,9 +1689,7 @@ function dispatchAction<S, A>(
17081689
const lane = requestUpdateLane(fiber, suspenseConfig);
17091690

17101691
const update: Update<S, A> = {
1711-
eventTime,
17121692
lane,
1713-
suspenseConfig,
17141693
action,
17151694
eagerReducer: null,
17161695
eagerState: null,

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

-21
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ import {
6262
warnIfNotCurrentlyActingEffectsInDEV,
6363
warnIfNotCurrentlyActingUpdatesInDev,
6464
warnIfNotScopedWithMatchingAct,
65-
markRenderEventTimeAndConfig,
6665
markSkippedUpdateLanes,
6766
} from './ReactFiberWorkLoop.old';
6867

@@ -96,11 +95,7 @@ import {markStateUpdateScheduled} from './SchedulingProfiler';
9695
const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals;
9796

9897
type Update<S, A> = {|
99-
// TODO: Temporary field. Will remove this by storing a map of
100-
// transition -> start time on the root.
101-
eventTime: number,
10298
lane: Lane,
103-
suspenseConfig: null | SuspenseConfig,
10499
action: A,
105100
eagerReducer: ((S, A) => S) | null,
106101
eagerState: S | null,
@@ -714,17 +709,13 @@ function updateReducer<S, I, A>(
714709
let newBaseQueueLast = null;
715710
let update = first;
716711
do {
717-
const suspenseConfig = update.suspenseConfig;
718712
const updateLane = update.lane;
719-
const updateEventTime = update.eventTime;
720713
if (!isSubsetOfLanes(renderLanes, updateLane)) {
721714
// Priority is insufficient. Skip this update. If this is the first
722715
// skipped update, the previous update/state is the new base
723716
// update/state.
724717
const clone: Update<S, A> = {
725-
eventTime: updateEventTime,
726718
lane: updateLane,
727-
suspenseConfig: suspenseConfig,
728719
action: update.action,
729720
eagerReducer: update.eagerReducer,
730721
eagerState: update.eagerState,
@@ -749,12 +740,10 @@ function updateReducer<S, I, A>(
749740

750741
if (newBaseQueueLast !== null) {
751742
const clone: Update<S, A> = {
752-
eventTime: updateEventTime,
753743
// This update is going to be committed so we never want uncommit
754744
// it. Using NoLane works because 0 is a subset of all bitmasks, so
755745
// this will never be skipped by the check above.
756746
lane: NoLane,
757-
suspenseConfig: update.suspenseConfig,
758747
action: update.action,
759748
eagerReducer: update.eagerReducer,
760749
eagerState: update.eagerState,
@@ -763,14 +752,6 @@ function updateReducer<S, I, A>(
763752
newBaseQueueLast = newBaseQueueLast.next = clone;
764753
}
765754

766-
// Mark the event time of this update as relevant to this render pass.
767-
// TODO: This should ideally use the true event time of this update rather than
768-
// its priority which is a derived and not reversible value.
769-
// TODO: We should skip this update if it was already committed but currently
770-
// we have no way of detecting the difference between a committed and suspended
771-
// update here.
772-
markRenderEventTimeAndConfig(updateEventTime, suspenseConfig);
773-
774755
// Process this update.
775756
if (update.eagerReducer === reducer) {
776757
// If this update was processed eagerly, and its reducer matches the
@@ -1706,9 +1687,7 @@ function dispatchAction<S, A>(
17061687
const lane = requestUpdateLane(fiber, suspenseConfig);
17071688

17081689
const update: Update<S, A> = {
1709-
eventTime,
17101690
lane,
1711-
suspenseConfig,
17121691
action,
17131692
eagerReducer: null,
17141693
eagerState: null,

packages/react-reconciler/src/ReactFiberLane.js

+3
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ export function includesNonIdleWork(lanes: Lanes) {
461461
export function includesOnlyRetries(lanes: Lanes) {
462462
return (lanes & RetryLanes) === lanes;
463463
}
464+
export function includesOnlyTransitions(lanes: Lanes) {
465+
return (lanes & TransitionLanes) === lanes;
466+
}
464467

465468
// To ensure consistency across multiple updates in the same event, this should
466469
// be a pure function, so that it always returns the same lane for given inputs.

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

-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ export function propagateContextChange(
212212
const update = createUpdate(
213213
NoTimestamp,
214214
pickArbitraryLane(renderLanes),
215-
null,
216215
);
217216
update.tag = ForceUpdate;
218217
// TODO: Because we don't have a work-in-progress, this will add the

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

-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ export function propagateContextChange(
212212
const update = createUpdate(
213213
NoTimestamp,
214214
pickArbitraryLane(renderLanes),
215-
null,
216215
);
217216
update.tag = ForceUpdate;
218217
// TODO: Because we don't have a work-in-progress, this will add the

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ export function updateContainer(
297297
}
298298
}
299299

300-
const update = createUpdate(eventTime, lane, suspenseConfig);
300+
const update = createUpdate(eventTime, lane);
301301
// Caution: React DevTools currently depends on this property
302302
// being called "element".
303303
update.payload = {element};

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ export function updateContainer(
297297
}
298298
}
299299

300-
const update = createUpdate(eventTime, lane, suspenseConfig);
300+
const update = createUpdate(eventTime, lane);
301301
// Caution: React DevTools currently depends on this property
302302
// being called "element".
303303
update.payload = {element};

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function createRootErrorUpdate(
7676
errorInfo: CapturedValue<mixed>,
7777
lane: Lane,
7878
): Update<mixed> {
79-
const update = createUpdate(NoTimestamp, lane, null);
79+
const update = createUpdate(NoTimestamp, lane);
8080
// Unmount the root by rendering null.
8181
update.tag = CaptureUpdate;
8282
// Caution: React DevTools currently depends on this property
@@ -95,7 +95,7 @@ function createClassErrorUpdate(
9595
errorInfo: CapturedValue<mixed>,
9696
lane: Lane,
9797
): Update<mixed> {
98-
const update = createUpdate(NoTimestamp, lane, null);
98+
const update = createUpdate(NoTimestamp, lane);
9999
update.tag = CaptureUpdate;
100100
const getDerivedStateFromError = fiber.type.getDerivedStateFromError;
101101
if (typeof getDerivedStateFromError === 'function') {
@@ -274,7 +274,7 @@ function throwException(
274274
// When we try rendering again, we should not reuse the current fiber,
275275
// since it's known to be in an inconsistent state. Use a force update to
276276
// prevent a bail out.
277-
const update = createUpdate(NoTimestamp, SyncLane, null);
277+
const update = createUpdate(NoTimestamp, SyncLane);
278278
update.tag = ForceUpdate;
279279
enqueueUpdate(sourceFiber, update);
280280
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function createRootErrorUpdate(
7676
errorInfo: CapturedValue<mixed>,
7777
lane: Lane,
7878
): Update<mixed> {
79-
const update = createUpdate(NoTimestamp, lane, null);
79+
const update = createUpdate(NoTimestamp, lane);
8080
// Unmount the root by rendering null.
8181
update.tag = CaptureUpdate;
8282
// Caution: React DevTools currently depends on this property
@@ -95,7 +95,7 @@ function createClassErrorUpdate(
9595
errorInfo: CapturedValue<mixed>,
9696
lane: Lane,
9797
): Update<mixed> {
98-
const update = createUpdate(NoTimestamp, lane, null);
98+
const update = createUpdate(NoTimestamp, lane);
9999
update.tag = CaptureUpdate;
100100
const getDerivedStateFromError = fiber.type.getDerivedStateFromError;
101101
if (typeof getDerivedStateFromError === 'function') {
@@ -276,7 +276,7 @@ function throwException(
276276
// When we try rendering again, we should not reuse the current fiber,
277277
// since it's known to be in an inconsistent state. Use a force update to
278278
// prevent a bail out.
279-
const update = createUpdate(NoTimestamp, SyncLane, null);
279+
const update = createUpdate(NoTimestamp, SyncLane);
280280
update.tag = ForceUpdate;
281281
enqueueUpdate(sourceFiber, update);
282282
}

0 commit comments

Comments
 (0)