Skip to content

Commit 4a74dd5

Browse files
committed
Ensure updates are applied when diffInCommitPhase is on (#26977)
When we diffInCommitPhase there's no updatePayload, which caused no update to be applied. This is unfortunate because it would've been a lot easier to see this oversight if we didn't have to support both flags. I also carified that updateHostComponent is unnecessary in the new flag. We reuse updateHostComponent for HostSingleton and HostHoistables since it has a somewhat complex path but that means you have to remember when editing updateHostComponent that it's not just used for that tag. Luckily with the new flag, this is actually unnecessary since we just need to mark it for update if any props have changed and then we diff it later. DiffTrain build for [d1c8cda](d1c8cda)
1 parent 063f0e3 commit 4a74dd5

15 files changed

+1279
-1149
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
613e6f5fca3a7a63d115988d6312beb84d37b4db
1+
d1c8cdae3b20a670ee91b684e8e0ad0c400ae51c

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-www-modern-58022814";
30+
var ReactVersion = "18.3.0-www-modern-20bf6d53";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
6969
return self;
7070
}
7171

72-
var ReactVersion = "18.3.0-www-modern-cbc1fa2b";
72+
var ReactVersion = "18.3.0-www-modern-b9ce8919";
7373

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;

compiled/facebook-www/ReactART-prod.modern.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9858,7 +9858,7 @@ var slice = Array.prototype.slice,
98589858
return null;
98599859
},
98609860
bundleType: 0,
9861-
version: "18.3.0-www-modern-12c03e2f",
9861+
version: "18.3.0-www-modern-a3ef0062",
98629862
rendererPackageName: "react-art"
98639863
};
98649864
var internals$jscomp$inline_1298 = {
@@ -9889,7 +9889,7 @@ var internals$jscomp$inline_1298 = {
98899889
scheduleRoot: null,
98909890
setRefreshHandler: null,
98919891
getCurrentFiber: null,
9892-
reconcilerVersion: "18.3.0-www-modern-12c03e2f"
9892+
reconcilerVersion: "18.3.0-www-modern-a3ef0062"
98939893
};
98949894
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
98959895
var hook$jscomp$inline_1299 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled/facebook-www/ReactDOM-dev.classic.js

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23859,11 +23859,18 @@ function completeWork(current, workInProgress, renderLanes) {
2385923859
return null;
2386023860
} else {
2386123861
// This is a Hoistable Instance
23862-
//
23863-
// We may have props to update on the Hoistable instance. We use the
23864-
// updateHostComponent path becuase it produces the update queue
23865-
// we need for Hoistables.
23866-
updateHostComponent(current, workInProgress, type, newProps); // This must come at the very end of the complete phase.
23862+
// We may have props to update on the Hoistable instance.
23863+
if (diffInCommitPhase && supportsMutation) {
23864+
var oldProps = current.memoizedProps;
23865+
23866+
if (oldProps !== newProps) {
23867+
markUpdate(workInProgress);
23868+
}
23869+
} else {
23870+
// We use the updateHostComponent path becuase it produces
23871+
// the update queue we need for Hoistables.
23872+
updateHostComponent(current, workInProgress, type, newProps);
23873+
} // This must come at the very end of the complete phase.
2386723874

2386823875
bubbleProperties(workInProgress);
2386923876
preloadInstanceAndSuspendIfNeeded(workInProgress);
@@ -23880,7 +23887,15 @@ function completeWork(current, workInProgress, renderLanes) {
2388023887
var _type = workInProgress.type;
2388123888

2388223889
if (current !== null && workInProgress.stateNode != null) {
23883-
updateHostComponent(current, workInProgress, _type, newProps);
23890+
if (diffInCommitPhase && supportsMutation) {
23891+
var _oldProps2 = current.memoizedProps;
23892+
23893+
if (_oldProps2 !== newProps) {
23894+
markUpdate(workInProgress);
23895+
}
23896+
} else {
23897+
updateHostComponent(current, workInProgress, _type, newProps);
23898+
}
2388423899

2388523900
if (current.ref !== workInProgress.ref) {
2388623901
markRef(workInProgress);
@@ -27366,7 +27381,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) {
2736627381
var updatePayload = finishedWork.updateQueue;
2736727382
finishedWork.updateQueue = null;
2736827383

27369-
if (updatePayload !== null) {
27384+
if (updatePayload !== null || diffInCommitPhase) {
2737027385
try {
2737127386
commitUpdate(
2737227387
finishedWork.stateNode,
@@ -34179,7 +34194,7 @@ function createFiberRoot(
3417934194
return root;
3418034195
}
3418134196

34182-
var ReactVersion = "18.3.0-www-classic-7c2add62";
34197+
var ReactVersion = "18.3.0-www-classic-ee7ec006";
3418334198

3418434199
function createPortal$1(
3418534200
children,
@@ -42590,6 +42605,10 @@ function handleErrorInNextTick(error) {
4259042605
throw error;
4259142606
});
4259242607
} // -------------------
42608+
// Mutation
42609+
// -------------------
42610+
42611+
var supportsMutation = true;
4259342612
function commitMount(domElement, type, newProps, internalInstanceHandle) {
4259442613
// Despite the naming that might imply otherwise, this method only
4259542614
// fires if there is an `Update` effect scheduled during mounting.

compiled/facebook-www/ReactDOM-dev.modern.js

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23731,11 +23731,18 @@ function completeWork(current, workInProgress, renderLanes) {
2373123731
return null;
2373223732
} else {
2373323733
// This is a Hoistable Instance
23734-
//
23735-
// We may have props to update on the Hoistable instance. We use the
23736-
// updateHostComponent path becuase it produces the update queue
23737-
// we need for Hoistables.
23738-
updateHostComponent(current, workInProgress, type, newProps); // This must come at the very end of the complete phase.
23734+
// We may have props to update on the Hoistable instance.
23735+
if (diffInCommitPhase && supportsMutation) {
23736+
var oldProps = current.memoizedProps;
23737+
23738+
if (oldProps !== newProps) {
23739+
markUpdate(workInProgress);
23740+
}
23741+
} else {
23742+
// We use the updateHostComponent path becuase it produces
23743+
// the update queue we need for Hoistables.
23744+
updateHostComponent(current, workInProgress, type, newProps);
23745+
} // This must come at the very end of the complete phase.
2373923746

2374023747
bubbleProperties(workInProgress);
2374123748
preloadInstanceAndSuspendIfNeeded(workInProgress);
@@ -23752,7 +23759,15 @@ function completeWork(current, workInProgress, renderLanes) {
2375223759
var _type = workInProgress.type;
2375323760

2375423761
if (current !== null && workInProgress.stateNode != null) {
23755-
updateHostComponent(current, workInProgress, _type, newProps);
23762+
if (diffInCommitPhase && supportsMutation) {
23763+
var _oldProps2 = current.memoizedProps;
23764+
23765+
if (_oldProps2 !== newProps) {
23766+
markUpdate(workInProgress);
23767+
}
23768+
} else {
23769+
updateHostComponent(current, workInProgress, _type, newProps);
23770+
}
2375623771

2375723772
if (current.ref !== workInProgress.ref) {
2375823773
markRef(workInProgress);
@@ -27216,7 +27231,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) {
2721627231
var updatePayload = finishedWork.updateQueue;
2721727232
finishedWork.updateQueue = null;
2721827233

27219-
if (updatePayload !== null) {
27234+
if (updatePayload !== null || diffInCommitPhase) {
2722027235
try {
2722127236
commitUpdate(
2722227237
finishedWork.stateNode,
@@ -34024,7 +34039,7 @@ function createFiberRoot(
3402434039
return root;
3402534040
}
3402634041

34027-
var ReactVersion = "18.3.0-www-modern-cbc1fa2b";
34042+
var ReactVersion = "18.3.0-www-modern-b9ce8919";
3402834043

3402934044
function createPortal$1(
3403034045
children,
@@ -43100,6 +43115,10 @@ function handleErrorInNextTick(error) {
4310043115
throw error;
4310143116
});
4310243117
} // -------------------
43118+
// Mutation
43119+
// -------------------
43120+
43121+
var supportsMutation = true;
4310343122
function commitMount(domElement, type, newProps, internalInstanceHandle) {
4310443123
// Despite the naming that might imply otherwise, this method only
4310543124
// fires if there is an `Update` effect scheduled during mounting.

0 commit comments

Comments
 (0)