Skip to content

Commit 9391eb7

Browse files
committed
Remove unnecessary Update fields
1 parent a9e9d14 commit 9391eb7

12 files changed

+16
-62
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

-12
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,7 @@ import {markStateUpdateScheduled} from './SchedulingProfiler';
9696
const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals;
9797

9898
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,
10299
lane: Lane,
103-
suspenseConfig: null | SuspenseConfig,
104100
action: A,
105101
eagerReducer: ((S, A) => S) | null,
106102
eagerState: S | null,
@@ -714,17 +710,13 @@ function updateReducer<S, I, A>(
714710
let newBaseQueueLast = null;
715711
let update = first;
716712
do {
717-
const suspenseConfig = update.suspenseConfig;
718713
const updateLane = update.lane;
719-
const updateEventTime = update.eventTime;
720714
if (!isSubsetOfLanes(renderLanes, updateLane)) {
721715
// Priority is insufficient. Skip this update. If this is the first
722716
// skipped update, the previous update/state is the new base
723717
// update/state.
724718
const clone: Update<S, A> = {
725-
eventTime: updateEventTime,
726719
lane: updateLane,
727-
suspenseConfig: suspenseConfig,
728720
action: update.action,
729721
eagerReducer: update.eagerReducer,
730722
eagerState: update.eagerState,
@@ -749,12 +741,10 @@ function updateReducer<S, I, A>(
749741

750742
if (newBaseQueueLast !== null) {
751743
const clone: Update<S, A> = {
752-
eventTime: updateEventTime,
753744
// This update is going to be committed so we never want uncommit
754745
// it. Using NoLane works because 0 is a subset of all bitmasks, so
755746
// this will never be skipped by the check above.
756747
lane: NoLane,
757-
suspenseConfig: update.suspenseConfig,
758748
action: update.action,
759749
eagerReducer: update.eagerReducer,
760750
eagerState: update.eagerState,
@@ -1699,9 +1689,7 @@ function dispatchAction<S, A>(
16991689
const lane = requestUpdateLane(fiber, suspenseConfig);
17001690

17011691
const update: Update<S, A> = {
1702-
eventTime,
17031692
lane,
1704-
suspenseConfig,
17051693
action,
17061694
eagerReducer: null,
17071695
eagerState: null,

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

-12
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ import {markStateUpdateScheduled} from './SchedulingProfiler';
9595
const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals;
9696

9797
type Update<S, A> = {|
98-
// TODO: Temporary field. Will remove this by storing a map of
99-
// transition -> start time on the root.
100-
eventTime: number,
10198
lane: Lane,
102-
suspenseConfig: null | SuspenseConfig,
10399
action: A,
104100
eagerReducer: ((S, A) => S) | null,
105101
eagerState: S | null,
@@ -713,17 +709,13 @@ function updateReducer<S, I, A>(
713709
let newBaseQueueLast = null;
714710
let update = first;
715711
do {
716-
const suspenseConfig = update.suspenseConfig;
717712
const updateLane = update.lane;
718-
const updateEventTime = update.eventTime;
719713
if (!isSubsetOfLanes(renderLanes, updateLane)) {
720714
// Priority is insufficient. Skip this update. If this is the first
721715
// skipped update, the previous update/state is the new base
722716
// update/state.
723717
const clone: Update<S, A> = {
724-
eventTime: updateEventTime,
725718
lane: updateLane,
726-
suspenseConfig: suspenseConfig,
727719
action: update.action,
728720
eagerReducer: update.eagerReducer,
729721
eagerState: update.eagerState,
@@ -748,12 +740,10 @@ function updateReducer<S, I, A>(
748740

749741
if (newBaseQueueLast !== null) {
750742
const clone: Update<S, A> = {
751-
eventTime: updateEventTime,
752743
// This update is going to be committed so we never want uncommit
753744
// it. Using NoLane works because 0 is a subset of all bitmasks, so
754745
// this will never be skipped by the check above.
755746
lane: NoLane,
756-
suspenseConfig: update.suspenseConfig,
757747
action: update.action,
758748
eagerReducer: update.eagerReducer,
759749
eagerState: update.eagerState,
@@ -1697,9 +1687,7 @@ function dispatchAction<S, A>(
16971687
const lane = requestUpdateLane(fiber, suspenseConfig);
16981688

16991689
const update: Update<S, A> = {
1700-
eventTime,
17011690
lane,
1702-
suspenseConfig,
17031691
action,
17041692
eagerReducer: null,
17051693
eagerState: null,

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
}

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

+1-11
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686

8787
import type {Fiber} from './ReactInternalTypes';
8888
import type {Lanes, Lane} from './ReactFiberLane';
89-
import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
9089

9190
import {NoLane, NoLanes, isSubsetOfLanes, mergeLanes} from './ReactFiberLane';
9291
import {
@@ -109,7 +108,6 @@ export type Update<State> = {|
109108
// transition -> event time on the root.
110109
eventTime: number,
111110
lane: Lane,
112-
suspenseConfig: null | SuspenseConfig,
113111

114112
tag: 0 | 1 | 2 | 3,
115113
payload: any,
@@ -183,15 +181,10 @@ export function cloneUpdateQueue<State>(
183181
}
184182
}
185183

186-
export function createUpdate(
187-
eventTime: number,
188-
lane: Lane,
189-
suspenseConfig: null | SuspenseConfig,
190-
): Update<*> {
184+
export function createUpdate(eventTime: number, lane: Lane): Update<*> {
191185
const update: Update<*> = {
192186
eventTime,
193187
lane,
194-
suspenseConfig,
195188

196189
tag: UpdateState,
197190
payload: null,
@@ -266,7 +259,6 @@ export function enqueueCapturedUpdate<State>(
266259
const clone: Update<State> = {
267260
eventTime: update.eventTime,
268261
lane: update.lane,
269-
suspenseConfig: update.suspenseConfig,
270262

271263
tag: update.tag,
272264
payload: update.payload,
@@ -479,7 +471,6 @@ export function processUpdateQueue<State>(
479471
const clone: Update<State> = {
480472
eventTime: updateEventTime,
481473
lane: updateLane,
482-
suspenseConfig: update.suspenseConfig,
483474

484475
tag: update.tag,
485476
payload: update.payload,
@@ -505,7 +496,6 @@ export function processUpdateQueue<State>(
505496
// it. Using NoLane works because 0 is a subset of all bitmasks, so
506497
// this will never be skipped by the check above.
507498
lane: NoLane,
508-
suspenseConfig: update.suspenseConfig,
509499

510500
tag: update.tag,
511501
payload: update.payload,

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

+1-11
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686

8787
import type {Fiber} from './ReactInternalTypes';
8888
import type {Lanes, Lane} from './ReactFiberLane';
89-
import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
9089

9190
import {NoLane, NoLanes, isSubsetOfLanes, mergeLanes} from './ReactFiberLane';
9291
import {
@@ -109,7 +108,6 @@ export type Update<State> = {|
109108
// transition -> event time on the root.
110109
eventTime: number,
111110
lane: Lane,
112-
suspenseConfig: null | SuspenseConfig,
113111

114112
tag: 0 | 1 | 2 | 3,
115113
payload: any,
@@ -183,15 +181,10 @@ export function cloneUpdateQueue<State>(
183181
}
184182
}
185183

186-
export function createUpdate(
187-
eventTime: number,
188-
lane: Lane,
189-
suspenseConfig: null | SuspenseConfig,
190-
): Update<*> {
184+
export function createUpdate(eventTime: number, lane: Lane): Update<*> {
191185
const update: Update<*> = {
192186
eventTime,
193187
lane,
194-
suspenseConfig,
195188

196189
tag: UpdateState,
197190
payload: null,
@@ -266,7 +259,6 @@ export function enqueueCapturedUpdate<State>(
266259
const clone: Update<State> = {
267260
eventTime: update.eventTime,
268261
lane: update.lane,
269-
suspenseConfig: update.suspenseConfig,
270262

271263
tag: update.tag,
272264
payload: update.payload,
@@ -479,7 +471,6 @@ export function processUpdateQueue<State>(
479471
const clone: Update<State> = {
480472
eventTime: updateEventTime,
481473
lane: updateLane,
482-
suspenseConfig: update.suspenseConfig,
483474

484475
tag: update.tag,
485476
payload: update.payload,
@@ -505,7 +496,6 @@ export function processUpdateQueue<State>(
505496
// it. Using NoLane works because 0 is a subset of all bitmasks, so
506497
// this will never be skipped by the check above.
507498
lane: NoLane,
508-
suspenseConfig: update.suspenseConfig,
509499

510500
tag: update.tag,
511501
payload: update.payload,

0 commit comments

Comments
 (0)