@@ -69,15 +69,19 @@ export function diffChildren(
6969
7070 let newChildrenLength = renderResult . length ;
7171
72+ let newChildren = new Array ( newChildrenLength ) ;
73+ newParentVNode . _children = newChildren ;
74+
7275 oldDom = constructNewChildrenArray (
7376 newParentVNode ,
77+ newChildren ,
7478 renderResult ,
7579 oldChildren ,
7680 oldDom
7781 ) ;
7882
7983 for ( i = 0 ; i < newChildrenLength ; i ++ ) {
80- childVNode = newParentVNode . _children [ i ] ;
84+ childVNode = newChildren [ i ] ;
8185 if ( childVNode == null ) continue ;
8286
8387 // At this point, constructNewChildrenArray has assigned _index to be the
@@ -144,11 +148,13 @@ export function diffChildren(
144148
145149/**
146150 * @param {VNode } newParentVNode
151+ * @param {VNode[] } newChildren
147152 * @param {ComponentChildren[] } renderResult
148153 * @param {VNode[] } oldChildren
149154 */
150155function constructNewChildrenArray (
151156 newParentVNode ,
157+ newChildren ,
152158 renderResult ,
153159 oldChildren ,
154160 oldDom
@@ -166,9 +172,6 @@ function constructNewChildrenArray(
166172
167173 let skew = 0 ;
168174
169- const newChildren = oldChildren . slice ( ) ;
170- newChildren . length = newChildrenLength ;
171- newParentVNode . _children = newChildren ;
172175 for ( i = 0 ; i < newChildrenLength ; i ++ ) {
173176 // @ts -expect-error We are reusing the childVNode variable to hold both the
174177 // pre and post normalized childVNode
0 commit comments