You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
Currently when cloning nodes in Fabric, we reset a node's children on
each clone, and then repeatedly call appendChild to restore the previous
list of children (even if it was quasi-identical to before). This causes
unnecessary invalidation of the layout state in Fabric's ShadowNode data
(which in turn may require additional yoga clones) and extra JSI calls.
This PR adds a feature flag to pass in the children as part of the clone
call, so Fabric always has a complete view of the node that's being
mutated.
This feature flag requires matching changes in the react-native repo:
facebook/react-native#39817
## How did you test this change?
Unit test added demonstrates the new behaviour
```
yarn test -r www-modern ReactFabric-test
yarn test ReactFabric-test.internal
```
Tested a manual sync into React Native and verified core surfaces render
correctly.
DiffTrain build for commit 151e75a.
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -8978,7 +8978,7 @@ var devToolsConfig$jscomp$inline_998 = {
8978
8978
throwError("TestRenderer does not support findFiberByHostInstance()");
8979
8979
},
8980
8980
bundleType: 0,
8981
-
version: "18.3.0-canary-dddfe6882-20231005",
8981
+
version: "18.3.0-canary-151e75a12-20231010",
8982
8982
rendererPackageName: "react-test-renderer"
8983
8983
};
8984
8984
varinternals$jscomp$inline_1191={
@@ -9009,7 +9009,7 @@ var internals$jscomp$inline_1191 = {
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9404,7 +9404,7 @@ var devToolsConfig$jscomp$inline_1040 = {
9404
9404
throwError("TestRenderer does not support findFiberByHostInstance()");
9405
9405
},
9406
9406
bundleType: 0,
9407
-
version: "18.3.0-canary-dddfe6882-20231005",
9407
+
version: "18.3.0-canary-151e75a12-20231010",
9408
9408
rendererPackageName: "react-test-renderer"
9409
9409
};
9410
9410
varinternals$jscomp$inline_1232={
@@ -9435,7 +9435,7 @@ var internals$jscomp$inline_1232 = {
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js
dynamicFlags.useMicrotasksForSchedulingInFabric; // The rest of the flags are static for better dead code elimination.
3183
+
dynamicFlags.useMicrotasksForSchedulingInFabric,
3184
+
passChildrenWhenCloningPersistedNodes =
3185
+
dynamicFlags.passChildrenWhenCloningPersistedNodes; // The rest of the flags are static for better dead code elimination.
3184
3186
var enableSchedulingProfiler = true;
3185
3187
var enableProfilerTimer = true;
3186
3188
var enableProfilerCommitHooks = true;
@@ -5007,9 +5009,8 @@ function cloneInstance(
5007
5009
type,
5008
5010
oldProps,
5009
5011
newProps,
5010
-
internalInstanceHandle,
5011
5012
keepChildren,
5012
-
recyclableInstance
5013
+
newChildSet
5013
5014
) {
5014
5015
var viewConfig = instance.canonical.viewConfig;
5015
5016
var updatePayload = diff(oldProps, newProps, viewConfig.validAttributes); // TODO: If the event handlers have changed, we need to update the current props
0 commit comments