Skip to content

Commit 8b596e0

Browse files
authored
Remove unused arguments in the reconciler (#18092)
1 parent 5de5b61 commit 8b596e0

7 files changed

+20
-69
lines changed

packages/react-reconciler/src/ReactChildFiber.js

+13-30
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,10 @@ function ChildReconciler(shouldTrackSideEffects) {
325325
return existingChildren;
326326
}
327327

328-
function useFiber(
329-
fiber: Fiber,
330-
pendingProps: mixed,
331-
expirationTime: ExpirationTime,
332-
): Fiber {
328+
function useFiber(fiber: Fiber, pendingProps: mixed): Fiber {
333329
// We currently set sibling to null and index to 0 here because it is easy
334330
// to forget to do before returning it. E.g. for the single child case.
335-
const clone = createWorkInProgress(fiber, pendingProps, expirationTime);
331+
const clone = createWorkInProgress(fiber, pendingProps);
336332
clone.index = 0;
337333
clone.sibling = null;
338334
return clone;
@@ -392,7 +388,7 @@ function ChildReconciler(shouldTrackSideEffects) {
392388
return created;
393389
} else {
394390
// Update
395-
const existing = useFiber(current, textContent, expirationTime);
391+
const existing = useFiber(current, textContent);
396392
existing.return = returnFiber;
397393
return existing;
398394
}
@@ -411,7 +407,7 @@ function ChildReconciler(shouldTrackSideEffects) {
411407
(__DEV__ ? isCompatibleFamilyForHotReloading(current, element) : false)
412408
) {
413409
// Move based on index
414-
const existing = useFiber(current, element.props, expirationTime);
410+
const existing = useFiber(current, element.props);
415411
existing.ref = coerceRef(returnFiber, current, element);
416412
existing.return = returnFiber;
417413
if (__DEV__) {
@@ -426,7 +422,7 @@ function ChildReconciler(shouldTrackSideEffects) {
426422
element.type.render === current.type.render
427423
) {
428424
// Same as above but also update the .type field.
429-
const existing = useFiber(current, element.props, expirationTime);
425+
const existing = useFiber(current, element.props);
430426
existing.return = returnFiber;
431427
existing.type = element.type;
432428
if (__DEV__) {
@@ -469,7 +465,7 @@ function ChildReconciler(shouldTrackSideEffects) {
469465
return created;
470466
} else {
471467
// Update
472-
const existing = useFiber(current, portal.children || [], expirationTime);
468+
const existing = useFiber(current, portal.children || []);
473469
existing.return = returnFiber;
474470
return existing;
475471
}
@@ -494,7 +490,7 @@ function ChildReconciler(shouldTrackSideEffects) {
494490
return created;
495491
} else {
496492
// Update
497-
const existing = useFiber(current, fragment, expirationTime);
493+
const existing = useFiber(current, fragment);
498494
existing.return = returnFiber;
499495
return existing;
500496
}
@@ -1137,7 +1133,7 @@ function ChildReconciler(shouldTrackSideEffects) {
11371133
// We already have an existing node so let's just update it and delete
11381134
// the rest.
11391135
deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
1140-
const existing = useFiber(currentFirstChild, textContent, expirationTime);
1136+
const existing = useFiber(currentFirstChild, textContent);
11411137
existing.return = returnFiber;
11421138
return existing;
11431139
}
@@ -1169,11 +1165,7 @@ function ChildReconciler(shouldTrackSideEffects) {
11691165
case Fragment: {
11701166
if (element.type === REACT_FRAGMENT_TYPE) {
11711167
deleteRemainingChildren(returnFiber, child.sibling);
1172-
const existing = useFiber(
1173-
child,
1174-
element.props.children,
1175-
expirationTime,
1176-
);
1168+
const existing = useFiber(child, element.props.children);
11771169
existing.return = returnFiber;
11781170
if (__DEV__) {
11791171
existing._debugSource = element._source;
@@ -1190,7 +1182,7 @@ function ChildReconciler(shouldTrackSideEffects) {
11901182
element.type.render === child.type.render
11911183
) {
11921184
deleteRemainingChildren(returnFiber, child.sibling);
1193-
const existing = useFiber(child, element.props, expirationTime);
1185+
const existing = useFiber(child, element.props);
11941186
existing.type = element.type;
11951187
existing.return = returnFiber;
11961188
if (__DEV__) {
@@ -1211,7 +1203,7 @@ function ChildReconciler(shouldTrackSideEffects) {
12111203
: false)
12121204
) {
12131205
deleteRemainingChildren(returnFiber, child.sibling);
1214-
const existing = useFiber(child, element.props, expirationTime);
1206+
const existing = useFiber(child, element.props);
12151207
existing.ref = coerceRef(returnFiber, child, element);
12161208
existing.return = returnFiber;
12171209
if (__DEV__) {
@@ -1271,11 +1263,7 @@ function ChildReconciler(shouldTrackSideEffects) {
12711263
child.stateNode.implementation === portal.implementation
12721264
) {
12731265
deleteRemainingChildren(returnFiber, child.sibling);
1274-
const existing = useFiber(
1275-
child,
1276-
portal.children || [],
1277-
expirationTime,
1278-
);
1266+
const existing = useFiber(child, portal.children || []);
12791267
existing.return = returnFiber;
12801268
return existing;
12811269
} else {
@@ -1441,11 +1429,7 @@ export function cloneChildFibers(
14411429
}
14421430

14431431
let currentChild = workInProgress.child;
1444-
let newChild = createWorkInProgress(
1445-
currentChild,
1446-
currentChild.pendingProps,
1447-
currentChild.expirationTime,
1448-
);
1432+
let newChild = createWorkInProgress(currentChild, currentChild.pendingProps);
14491433
workInProgress.child = newChild;
14501434

14511435
newChild.return = workInProgress;
@@ -1454,7 +1438,6 @@ export function cloneChildFibers(
14541438
newChild = newChild.sibling = createWorkInProgress(
14551439
currentChild,
14561440
currentChild.pendingProps,
1457-
currentChild.expirationTime,
14581441
);
14591442
newChild.return = workInProgress;
14601443
}

packages/react-reconciler/src/ReactFiber.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,7 @@ export function resolveLazyComponentTag(Component: Function): WorkTag {
401401
}
402402

403403
// This is used to create an alternate fiber to do work on.
404-
export function createWorkInProgress(
405-
current: Fiber,
406-
pendingProps: any,
407-
expirationTime: ExpirationTime,
408-
): Fiber {
404+
export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber {
409405
let workInProgress = current.alternate;
410406
if (workInProgress === null) {
411407
// We use a double buffering pooling technique because we know that we'll

packages/react-reconciler/src/ReactFiberBeginWork.js

+3-19
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,7 @@ function updateMemoComponent(
466466
}
467467
// React DevTools reads this flag.
468468
workInProgress.effectTag |= PerformedWork;
469-
let newChild = createWorkInProgress(
470-
currentChild,
471-
nextProps,
472-
renderExpirationTime,
473-
);
469+
let newChild = createWorkInProgress(currentChild, nextProps);
474470
newChild.ref = workInProgress.ref;
475471
newChild.return = workInProgress;
476472
workInProgress.child = newChild;
@@ -831,12 +827,7 @@ function updateClassComponent(
831827
workInProgress.effectTag |= Placement;
832828
}
833829
// In the initial pass we might need to construct the instance.
834-
constructClassInstance(
835-
workInProgress,
836-
Component,
837-
nextProps,
838-
renderExpirationTime,
839-
);
830+
constructClassInstance(workInProgress, Component, nextProps);
840831
mountClassInstance(
841832
workInProgress,
842833
Component,
@@ -1296,12 +1287,7 @@ function mountIncompleteClassComponent(
12961287
}
12971288
prepareToReadContext(workInProgress, renderExpirationTime);
12981289

1299-
constructClassInstance(
1300-
workInProgress,
1301-
Component,
1302-
nextProps,
1303-
renderExpirationTime,
1304-
);
1290+
constructClassInstance(workInProgress, Component, nextProps);
13051291
mountClassInstance(
13061292
workInProgress,
13071293
Component,
@@ -1871,7 +1857,6 @@ function updateSuspenseComponent(
18711857
const primaryChildFragment = createWorkInProgress(
18721858
currentPrimaryChildFragment,
18731859
currentPrimaryChildFragment.pendingProps,
1874-
NoWork,
18751860
);
18761861
primaryChildFragment.return = workInProgress;
18771862

@@ -1911,7 +1896,6 @@ function updateSuspenseComponent(
19111896
const fallbackChildFragment = createWorkInProgress(
19121897
currentFallbackChildFragment,
19131898
nextFallbackChildren,
1914-
currentFallbackChildFragment.expirationTime,
19151899
);
19161900
fallbackChildFragment.return = workInProgress;
19171901
primaryChildFragment.sibling = fallbackChildFragment;

packages/react-reconciler/src/ReactFiberClassComponent.js

-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,6 @@ function constructClassInstance(
535535
workInProgress: Fiber,
536536
ctor: any,
537537
props: any,
538-
renderExpirationTime: ExpirationTime,
539538
): any {
540539
let isLegacyContextConsumer = false;
541540
let unmaskedContext = emptyContextObject;

packages/react-reconciler/src/ReactFiberCommitWork.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -576,12 +576,7 @@ function commitLifeCycles(
576576
// We could update instance props and state here,
577577
// but instead we rely on them being set during last render.
578578
// TODO: revisit this when we implement resuming.
579-
commitUpdateQueue(
580-
finishedWork,
581-
updateQueue,
582-
instance,
583-
committedExpirationTime,
584-
);
579+
commitUpdateQueue(finishedWork, updateQueue, instance);
585580
}
586581
return;
587582
}
@@ -599,12 +594,7 @@ function commitLifeCycles(
599594
break;
600595
}
601596
}
602-
commitUpdateQueue(
603-
finishedWork,
604-
updateQueue,
605-
instance,
606-
committedExpirationTime,
607-
);
597+
commitUpdateQueue(finishedWork, updateQueue, instance);
608598
}
609599
return;
610600
}

packages/react-reconciler/src/ReactFiberWorkLoop.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ function prepareFreshStack(root, expirationTime) {
12521252
}
12531253
}
12541254
workInProgressRoot = root;
1255-
workInProgress = createWorkInProgress(root.current, null, expirationTime);
1255+
workInProgress = createWorkInProgress(root.current, null);
12561256
renderExpirationTime = expirationTime;
12571257
workInProgressRootExitStatus = RootIncomplete;
12581258
workInProgressRootFatalError = null;

packages/react-reconciler/src/ReactUpdateQueue.js

-1
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,6 @@ export function commitUpdateQueue<State>(
528528
finishedWork: Fiber,
529529
finishedQueue: UpdateQueue<State>,
530530
instance: any,
531-
renderExpirationTime: ExpirationTime,
532531
): void {
533532
// Commit the effects
534533
const effects = finishedQueue.effects;

0 commit comments

Comments
 (0)