Simplify StubViewTree creation (#51221)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51221

In the case of an empty root node, we don't need `buildStubViewTreeWithoutUsingDifferentiator` to create the initial `StubViewTree`

When testing with Fantom, this caused an additional unnecessary clone of RootShadowNode.

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D74472766

fbshipit-source-id: 076e859a6c5795e9026c7a5f8246a5658db4a94b
This commit is contained in:
Pieter De Baets
2025-05-09 08:36:44 -07:00
committed by Facebook GitHub Bot
parent 35c96007eb
commit cf428bde1c
2 changed files with 2 additions and 2 deletions
@@ -121,7 +121,7 @@ static void testShadowNodeTreeLifeCycleLayoutAnimations(
ShadowNode::ListOfShared{singleRootChildNode})}));
// Building an initial view hierarchy.
auto viewTree = buildStubViewTreeWithoutUsingDifferentiator(*emptyRootNode);
auto viewTree = StubViewTree(ShadowView(*emptyRootNode));
viewTree.mutate(
calculateShadowViewMutations(*emptyRootNode, *currentRootNode));
@@ -80,7 +80,7 @@ static void testShadowNodeTreeLifeCycle(
ShadowNode::ListOfShared{singleRootChildNode})}));
// Building an initial view hierarchy.
auto viewTree = buildStubViewTreeWithoutUsingDifferentiator(*emptyRootNode);
auto viewTree = StubViewTree(ShadowView(*emptyRootNode));
viewTree.mutate(
calculateShadowViewMutations(*emptyRootNode, *currentRootNode));