@@ -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 ) {
@@ -391,11 +389,10 @@ function constructNewChildrenArray(
391389 * @param {VNode } parentVNode
392390 * @param {PreactElement } oldDom
393391 * @param {PreactElement } parentDom
394- * @param {number } shouldPlace
395392 * @param {boolean } isMounting
396393 * @returns {PreactElement }
397394 */
398- function insert ( parentVNode , oldDom , parentDom , shouldPlace , isMounting ) {
395+ function insert ( parentVNode , oldDom , parentDom , isMounting ) {
399396 // Note: VNodes in nested suspended trees may be missing _children.
400397 if ( typeof parentVNode . type == 'function' ) {
401398 // Root children live in another container, they never move with the
@@ -409,23 +406,21 @@ function insert(parentVNode, oldDom, parentDom, shouldPlace, isMounting) {
409406 // children's _parent pointer to point to the newVNode (parentVNode
410407 // here).
411408 children [ i ] . _parent = parentVNode ;
412- oldDom = insert ( children [ i ] , oldDom , parentDom , shouldPlace , false ) ;
409+ oldDom = insert ( children [ i ] , oldDom , parentDom , false ) ;
413410 }
414411 }
415412
416413 return oldDom ;
417414 } else if ( parentVNode . _dom != oldDom ) {
418- if ( shouldPlace ) {
419- if ( oldDom && parentVNode . type && ! oldDom . parentNode ) {
420- oldDom = getDomSibling ( parentVNode ) ;
421- }
415+ if ( oldDom && parentVNode . type && ! oldDom . parentNode ) {
416+ oldDom = getDomSibling ( parentVNode ) ;
417+ }
422418
423- if ( HAS_MOVE_BEFORE_SUPPORT && ! isMounting ) {
424- // @ts -expect-error This isn't added to TypeScript lib.d.ts yet
425- parentDom . moveBefore ( parentVNode . _dom , oldDom ) ;
426- } else {
427- parentDom . insertBefore ( parentVNode . _dom , oldDom || NULL ) ;
428- }
419+ if ( HAS_MOVE_BEFORE_SUPPORT && ! isMounting ) {
420+ // @ts -expect-error This isn't added to TypeScript lib.d.ts yet
421+ parentDom . moveBefore ( parentVNode . _dom , oldDom ) ;
422+ } else {
423+ parentDom . insertBefore ( parentVNode . _dom , oldDom || NULL ) ;
429424 }
430425 oldDom = parentVNode . _dom ;
431426 }
0 commit comments