@@ -126,21 +126,19 @@ export function diffChildren(
126126 firstChildDom = newDom ;
127127 }
128128
129- let shouldPlace = childVNode . _flags & INSERT_VNODE ;
130- if ( shouldPlace || oldVNode . _children === childVNode . _children ) {
129+ if ( childVNode . _flags & INSERT_VNODE ) {
131130 oldDom = insert (
132131 childVNode ,
133132 oldDom ,
134133 parentDom ,
135- shouldPlace ,
136134 oldVNode . _original == NULL
137135 ) ;
138136
139137 // When a matched VNode is physically moved via INSERT_VNODE, its old
140138 // _dom pointer becomes a stale positional reference. Clear it so that
141139 // getDomSibling (called from nested diffs) won't return this stale
142140 // reference and mis-place subsequent DOM nodes. See #5065.
143- if ( shouldPlace && oldVNode . _dom ) {
141+ if ( oldVNode . _dom ) {
144142 oldVNode . _dom = NULL ;
145143 }
146144 } else if ( typeof childVNode . type == 'function' && result !== UNDEFINED ) {
@@ -351,11 +349,10 @@ function constructNewChildrenArray(
351349 * @param {VNode } parentVNode
352350 * @param {PreactElement } oldDom
353351 * @param {PreactElement } parentDom
354- * @param {number } shouldPlace
355352 * @param {boolean } isMounting
356353 * @returns {PreactElement }
357354 */
358- function insert ( parentVNode , oldDom , parentDom , shouldPlace , isMounting ) {
355+ function insert ( parentVNode , oldDom , parentDom , isMounting ) {
359356 // Note: VNodes in nested suspended trees may be missing _children.
360357 if ( typeof parentVNode . type == 'function' ) {
361358 // Root children live in another container, they never move with the
@@ -369,23 +366,21 @@ function insert(parentVNode, oldDom, parentDom, shouldPlace, isMounting) {
369366 // children's _parent pointer to point to the newVNode (parentVNode
370367 // here).
371368 children [ i ] . _parent = parentVNode ;
372- oldDom = insert ( children [ i ] , oldDom , parentDom , shouldPlace , false ) ;
369+ oldDom = insert ( children [ i ] , oldDom , parentDom , false ) ;
373370 }
374371 }
375372
376373 return oldDom ;
377374 } else if ( parentVNode . _dom != oldDom ) {
378- if ( shouldPlace ) {
379- if ( oldDom && parentVNode . type && ! oldDom . parentNode ) {
380- oldDom = getDomSibling ( parentVNode ) ;
381- }
375+ if ( oldDom && parentVNode . type && ! oldDom . parentNode ) {
376+ oldDom = getDomSibling ( parentVNode ) ;
377+ }
382378
383- if ( HAS_MOVE_BEFORE_SUPPORT && ! isMounting ) {
384- // @ts -expect-error This isn't added to TypeScript lib.d.ts yet
385- parentDom . moveBefore ( parentVNode . _dom , oldDom ) ;
386- } else {
387- parentDom . insertBefore ( parentVNode . _dom , oldDom || NULL ) ;
388- }
379+ if ( HAS_MOVE_BEFORE_SUPPORT && ! isMounting ) {
380+ // @ts -expect-error This isn't added to TypeScript lib.d.ts yet
381+ parentDom . moveBefore ( parentVNode . _dom , oldDom ) ;
382+ } else {
383+ parentDom . insertBefore ( parentVNode . _dom , oldDom || NULL ) ;
389384 }
390385 oldDom = parentVNode . _dom ;
391386 }
0 commit comments