@samitouri / QOS-React / commits / 8b596e00a4

Remove unused arguments in the reconciler (#18092)

Dan Abramov committed Feb 21, 2020 at 02:26 UTC 8b596e00a4fffd6bb5e6990f4dd59e40e80a5ea0
7 files changed +20 -69
packages/react-reconciler/src/ReactChildFiber.js
+13 -30
@@ -325,14 +325,10 @@ function ChildReconciler(shouldTrackSideEffects) {
325 return existingChildren;
326 }
327
328 - function useFiber(
329 - fiber: Fiber,
330 - pendingProps: mixed,
331 - expirationTime: ExpirationTime,
332 - ): Fiber {
328 + function useFiber(fiber: Fiber, pendingProps: mixed): Fiber {
329 // We currently set sibling to null and index to 0 here because it is easy
330 // 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);
332 clone.index = 0;
333 clone.sibling = null;
334 return clone;
@@ -392,7 +388,7 @@ function ChildReconciler(shouldTrackSideEffects) {
388 return created;
389 } else {
390 // Update
395 - const existing = useFiber(current, textContent, expirationTime);
391 + const existing = useFiber(current, textContent);
392 existing.return = returnFiber;
393 return existing;
394 }
@@ -411,7 +407,7 @@ function ChildReconciler(shouldTrackSideEffects) {
407 (__DEV__ ? isCompatibleFamilyForHotReloading(current, element) : false)
408 ) {
409 // Move based on index
414 - const existing = useFiber(current, element.props, expirationTime);
410 + const existing = useFiber(current, element.props);
411 existing.ref = coerceRef(returnFiber, current, element);
412 existing.return = returnFiber;
413 if (__DEV__) {
@@ -426,7 +422,7 @@ function ChildReconciler(shouldTrackSideEffects) {
422 element.type.render === current.type.render
423 ) {
424 // Same as above but also update the .type field.
429 - const existing = useFiber(current, element.props, expirationTime);
425 + const existing = useFiber(current, element.props);
426 existing.return = returnFiber;
427 existing.type = element.type;
428 if (__DEV__) {
@@ -469,7 +465,7 @@ function ChildReconciler(shouldTrackSideEffects) {
465 return created;
466 } else {
467 // Update
472 - const existing = useFiber(current, portal.children || [], expirationTime);
468 + const existing = useFiber(current, portal.children || []);
469 existing.return = returnFiber;
470 return existing;
471 }
@@ -494,7 +490,7 @@ function ChildReconciler(shouldTrackSideEffects) {
490 return created;
491 } else {
492 // Update
497 - const existing = useFiber(current, fragment, expirationTime);
493 + const existing = useFiber(current, fragment);
494 existing.return = returnFiber;
495 return existing;
496 }
@@ -1137,7 +1133,7 @@ function ChildReconciler(shouldTrackSideEffects) {
1133 // We already have an existing node so let's just update it and delete
1134 // the rest.
1135 deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
1140 - const existing = useFiber(currentFirstChild, textContent, expirationTime);
1136 + const existing = useFiber(currentFirstChild, textContent);
1137 existing.return = returnFiber;
1138 return existing;
1139 }
@@ -1169,11 +1165,7 @@ function ChildReconciler(shouldTrackSideEffects) {
1165 case Fragment: {
1166 if (element.type === REACT_FRAGMENT_TYPE) {
1167 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);
1169 existing.return = returnFiber;
1170 if (__DEV__) {
1171 existing._debugSource = element._source;
@@ -1190,7 +1182,7 @@ function ChildReconciler(shouldTrackSideEffects) {
1182 element.type.render === child.type.render
1183 ) {
1184 deleteRemainingChildren(returnFiber, child.sibling);
1193 - const existing = useFiber(child, element.props, expirationTime);
1185 + const existing = useFiber(child, element.props);
1186 existing.type = element.type;
1187 existing.return = returnFiber;
1188 if (__DEV__) {
@@ -1211,7 +1203,7 @@ function ChildReconciler(shouldTrackSideEffects) {
1203 : false)
1204 ) {
1205 deleteRemainingChildren(returnFiber, child.sibling);
1214 - const existing = useFiber(child, element.props, expirationTime);
1206 + const existing = useFiber(child, element.props);
1207 existing.ref = coerceRef(returnFiber, child, element);
1208 existing.return = returnFiber;
1209 if (__DEV__) {
@@ -1271,11 +1263,7 @@ function ChildReconciler(shouldTrackSideEffects) {
1263 child.stateNode.implementation === portal.implementation
1264 ) {
1265 deleteRemainingChildren(returnFiber, child.sibling);
1274 - const existing = useFiber(
1275 - child,
1276 - portal.children || [],
1277 - expirationTime,
1278 - );
1266 + const existing = useFiber(child, portal.children || []);
1267 existing.return = returnFiber;
1268 return existing;
1269 } else {
@@ -1441,11 +1429,7 @@ export function cloneChildFibers(
1429 }
1430
1431 let currentChild = workInProgress.child;
1444 - let newChild = createWorkInProgress(
1445 - currentChild,
1446 - currentChild.pendingProps,
1447 - currentChild.expirationTime,
1448 - );
1432 + let newChild = createWorkInProgress(currentChild, currentChild.pendingProps);
1433 workInProgress.child = newChild;
1434
1435 newChild.return = workInProgress;
@@ -1454,7 +1438,6 @@ export function cloneChildFibers(
1438 newChild = newChild.sibling = createWorkInProgress(
1439 currentChild,
1440 currentChild.pendingProps,
1457 - currentChild.expirationTime,
1441 );
1442 newChild.return = workInProgress;
1443 }
packages/react-reconciler/src/ReactFiber.js
+1 -5
@@ -401,11 +401,7 @@ export function resolveLazyComponentTag(Component: Function): WorkTag {
401 }
402
403 // 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 {
405 let workInProgress = current.alternate;
406 if (workInProgress === null) {
407 // We use a double buffering pooling technique because we know that we'll
packages/react-reconciler/src/ReactFiberBeginWork.js
+3 -19
@@ -466,11 +466,7 @@ function updateMemoComponent(
466 }
467 // React DevTools reads this flag.
468 workInProgress.effectTag |= PerformedWork;
469 - let newChild = createWorkInProgress(
470 - currentChild,
471 - nextProps,
472 - renderExpirationTime,
473 - );
469 + let newChild = createWorkInProgress(currentChild, nextProps);
470 newChild.ref = workInProgress.ref;
471 newChild.return = workInProgress;
472 workInProgress.child = newChild;
@@ -831,12 +827,7 @@ function updateClassComponent(
827 workInProgress.effectTag |= Placement;
828 }
829 // 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);
831 mountClassInstance(
832 workInProgress,
833 Component,
@@ -1296,12 +1287,7 @@ function mountIncompleteClassComponent(
1287 }
1288 prepareToReadContext(workInProgress, renderExpirationTime);
1289
1299 - constructClassInstance(
1300 - workInProgress,
1301 - Component,
1302 - nextProps,
1303 - renderExpirationTime,
1304 - );
1290 + constructClassInstance(workInProgress, Component, nextProps);
1291 mountClassInstance(
1292 workInProgress,
1293 Component,
@@ -1871,7 +1857,6 @@ function updateSuspenseComponent(
1857 const primaryChildFragment = createWorkInProgress(
1858 currentPrimaryChildFragment,
1859 currentPrimaryChildFragment.pendingProps,
1874 - NoWork,
1860 );
1861 primaryChildFragment.return = workInProgress;
1862
@@ -1911,7 +1896,6 @@ function updateSuspenseComponent(
1896 const fallbackChildFragment = createWorkInProgress(
1897 currentFallbackChildFragment,
1898 nextFallbackChildren,
1914 - currentFallbackChildFragment.expirationTime,
1899 );
1900 fallbackChildFragment.return = workInProgress;
1901 primaryChildFragment.sibling = fallbackChildFragment;
packages/react-reconciler/src/ReactFiberClassComponent.js
-1
@@ -535,7 +535,6 @@ function constructClassInstance(
535 workInProgress: Fiber,
536 ctor: any,
537 props: any,
538 - renderExpirationTime: ExpirationTime,
538 ): any {
539 let isLegacyContextConsumer = false;
540 let unmaskedContext = emptyContextObject;
packages/react-reconciler/src/ReactFiberCommitWork.js
+2 -12
@@ -576,12 +576,7 @@ function commitLifeCycles(
576 // We could update instance props and state here,
577 // but instead we rely on them being set during last render.
578 // TODO: revisit this when we implement resuming.
579 - commitUpdateQueue(
580 - finishedWork,
581 - updateQueue,
582 - instance,
583 - committedExpirationTime,
584 - );
579 + commitUpdateQueue(finishedWork, updateQueue, instance);
580 }
581 return;
582 }
@@ -599,12 +594,7 @@ function commitLifeCycles(
594 break;
595 }
596 }
602 - commitUpdateQueue(
603 - finishedWork,
604 - updateQueue,
605 - instance,
606 - committedExpirationTime,
607 - );
597 + commitUpdateQueue(finishedWork, updateQueue, instance);
598 }
599 return;
600 }
packages/react-reconciler/src/ReactFiberWorkLoop.js
+1 -1
@@ -1252,7 +1252,7 @@ function prepareFreshStack(root, expirationTime) {
1252 }
1253 }
1254 workInProgressRoot = root;
1255 - workInProgress = createWorkInProgress(root.current, null, expirationTime);
1255 + workInProgress = createWorkInProgress(root.current, null);
1256 renderExpirationTime = expirationTime;
1257 workInProgressRootExitStatus = RootIncomplete;
1258 workInProgressRootFatalError = null;
packages/react-reconciler/src/ReactUpdateQueue.js
-1
@@ -528,7 +528,6 @@ export function commitUpdateQueue<State>(
528 finishedWork: Fiber,
529 finishedQueue: UpdateQueue<State>,
530 instance: any,
531 - renderExpirationTime: ExpirationTime,
531 ): void {
532 // Commit the effects
533 const effects = finishedQueue.effects;