perf(ivy): don't relink the whole tree when `TNode` exists (#30511)
PR Close #30511
This commit is contained in:
parent
79903b1842
commit
f2ae452f01
|
@ -271,11 +271,8 @@ export function createNodeAtIndex(
|
||||||
const tParentNode = parentInSameView ? parent as TElementNode | TContainerNode : null;
|
const tParentNode = parentInSameView ? parent as TElementNode | TContainerNode : null;
|
||||||
|
|
||||||
tNode = tView.data[adjustedIndex] = createTNode(tParentNode, type, adjustedIndex, name, attrs);
|
tNode = tView.data[adjustedIndex] = createTNode(tParentNode, type, adjustedIndex, name, attrs);
|
||||||
}
|
|
||||||
|
|
||||||
// Now link ourselves into the tree.
|
// Now link ourselves into the tree.
|
||||||
// We need this even if tNode exists, otherwise we might end up pointing to unexisting tNodes when
|
|
||||||
// we use i18n (especially with ICU expressions that update the DOM during the update phase).
|
|
||||||
if (previousOrParentTNode) {
|
if (previousOrParentTNode) {
|
||||||
if (isParent && previousOrParentTNode.child == null &&
|
if (isParent && previousOrParentTNode.child == null &&
|
||||||
(tNode.parent !== null || previousOrParentTNode.type === TNodeType.View)) {
|
(tNode.parent !== null || previousOrParentTNode.type === TNodeType.View)) {
|
||||||
|
@ -285,6 +282,7 @@ export function createNodeAtIndex(
|
||||||
previousOrParentTNode.next = tNode;
|
previousOrParentTNode.next = tNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (tView.firstChild == null) {
|
if (tView.firstChild == null) {
|
||||||
tView.firstChild = tNode;
|
tView.firstChild = tNode;
|
||||||
|
|
Loading…
Reference in New Issue