Skip to content

Pass pendingProps as argument in createWorkInProgress #10643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/renderers/shared/fiber/ReactChildFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
// We currently set sibling to null and index to 0 here because it is easy
// to forget to do before returning it. E.g. for the single child case.
if (shouldClone) {
const clone = createWorkInProgress(fiber, priority);
const clone = createWorkInProgress(fiber, priority, null);
clone.index = 0;
clone.sibling = null;
return clone;
Expand Down Expand Up @@ -1443,9 +1443,8 @@ exports.cloneChildFibers = function(
let newChild = createWorkInProgress(
currentChild,
currentChild.pendingWorkPriority,
currentChild.pendingProps,
);
// TODO: Pass this as an argument, since it's easy to forget.
newChild.pendingProps = currentChild.pendingProps;
workInProgress.child = newChild;

newChild.return = workInProgress;
Expand All @@ -1454,8 +1453,8 @@ exports.cloneChildFibers = function(
newChild = newChild.sibling = createWorkInProgress(
currentChild,
currentChild.pendingWorkPriority,
currentChild.pendingProps,
);
newChild.pendingProps = currentChild.pendingProps;
newChild.return = workInProgress;
}
newChild.sibling = null;
Expand Down
3 changes: 2 additions & 1 deletion src/renderers/shared/fiber/ReactFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ function shouldConstruct(Component) {
exports.createWorkInProgress = function(
current: Fiber,
renderPriority: PriorityLevel,
pendingProps: any,
): Fiber {
let workInProgress = current.alternate;
if (workInProgress === null) {
Expand Down Expand Up @@ -281,7 +282,7 @@ exports.createWorkInProgress = function(
workInProgress.updateQueue = current.updateQueue;

// pendingProps is set by the parent during reconciliation.
// TODO: Pass this as an argument.
workInProgress.pendingProps = pendingProps;

// These will be overridden during the parent's reconciliation
workInProgress.sibling = current.sibling;
Expand Down