@@ -227,52 +227,24 @@ function constructNewChildrenArray(newParentVNode, renderResult, oldChildren) {
227227 childVNode = newParentVNode . _children [ i ] = childVNode ;
228228 }
229229
230- const skewedIndex = i + skew ;
231-
232230 // Handle unmounting null placeholders, i.e. VNode => null in unkeyed children
233231 if ( childVNode == null ) {
234- oldVNode = oldChildren [ skewedIndex ] ;
235- if (
236- oldVNode &&
237- oldVNode . key == null &&
238- oldVNode . _dom &&
239- ( oldVNode . _flags & MATCHED ) === 0
240- ) {
241- if ( oldVNode . _dom == newParentVNode . _nextDom ) {
242- newParentVNode . _nextDom = getDomSibling ( oldVNode ) ;
243- }
244-
245- unmount ( oldVNode , oldVNode , false ) ;
246-
247- // Explicitly nullify this position in oldChildren instead of just
248- // setting `_match=true` to prevent other routines (e.g.
249- // `findMatchingIndex` or `getDomSibling`) from thinking VNodes or DOM
250- // nodes in this position are still available to be used in diffing when
251- // they have actually already been unmounted. For example, by only
252- // setting `_match=true` here, the unmounting loop later would attempt
253- // to unmount this VNode again seeing `_match==true`. Further,
254- // getDomSibling doesn't know about _match and so would incorrectly
255- // assume DOM nodes in this subtree are mounted and usable.
256- oldChildren [ skewedIndex ] = null ;
257- remainingOldChildren -- ;
258- }
259232 continue ;
260233 }
261234
235+ const skewedIndex = i + skew ;
262236 childVNode . _parent = newParentVNode ;
263237 childVNode . _depth = newParentVNode . _depth + 1 ;
264238
265- const matchingIndex = findMatchingIndex (
239+ // Temporarily store the matchingIndex on the _index property so we can pull
240+ // out the oldVNode in diffChildren. We'll override this to the VNode's
241+ // final index after using this property to get the oldVNode
242+ const matchingIndex = ( childVNode . _index = findMatchingIndex (
266243 childVNode ,
267244 oldChildren ,
268245 skewedIndex ,
269246 remainingOldChildren
270- ) ;
271-
272- // Temporarily store the matchingIndex on the _index property so we can pull
273- // out the oldVNode in diffChildren. We'll override this to the VNode's
274- // final index after using this property to get the oldVNode
275- childVNode . _index = matchingIndex ;
247+ ) ) ;
276248
277249 oldVNode = null ;
278250 if ( matchingIndex !== - 1 ) {
@@ -318,16 +290,18 @@ function constructNewChildrenArray(newParentVNode, renderResult, oldChildren) {
318290 skew -- ;
319291 } else if ( matchingIndex == skewedIndex + 1 ) {
320292 skew ++ ;
321- } else if ( matchingIndex > skewedIndex ) {
322- skew -- ;
323293 } else {
324- skew ++ ;
325- }
294+ if ( matchingIndex > skewedIndex ) {
295+ skew -- ;
296+ } else {
297+ skew ++ ;
298+ }
326299
327- // Move this VNode's DOM if the original index (matchingIndex) doesn't
328- // match the new skew index (i + new skew)
329- if ( matchingIndex !== i + skew ) {
330- childVNode . _flags |= INSERT_VNODE ;
300+ // Move this VNode's DOM if the original index (matchingIndex) doesn't
301+ // match the new skew index (i + new skew)
302+ if ( matchingIndex !== i + skew ) {
303+ childVNode . _flags |= INSERT_VNODE ;
304+ }
331305 }
332306 }
333307 }
0 commit comments