@@ -52,9 +52,9 @@ export function diff(
52
52
// If the previous diff bailed out, resume creating/hydrating.
53
53
if ( oldVNode . _flags & MODE_SUSPENDED ) {
54
54
isHydrating = ! ! ( oldVNode . _flags & MODE_HYDRATE ) ;
55
- if ( oldVNode . _excess ) {
56
- excessDomChildren = oldVNode . _excess ;
57
- oldDom = newVNode . _dom = oldVNode . _dom = excessDomChildren [ 1 ] ;
55
+ if ( oldVNode . _component . _excess ) {
56
+ excessDomChildren = oldVNode . _component . _excess ;
57
+ oldDom = newVNode . _dom = oldVNode . _dom = excessDomChildren [ 0 ] ;
58
58
} else {
59
59
oldDom = newVNode . _dom = oldVNode . _dom ;
60
60
excessDomChildren = [ oldDom ] ;
@@ -283,26 +283,32 @@ export function diff(
283
283
: MODE_HYDRATE ;
284
284
285
285
let found = excessDomChildren . find (
286
- child => child && child . nodeType == 8 && child . data == '$s'
287
- ) ,
288
- index = excessDomChildren . indexOf ( found ) + 1 ;
286
+ child => child && child . nodeType == 8 && child . data == '$s'
287
+ ) ;
289
288
290
289
newVNode . _dom = oldDom ;
291
290
if ( found ) {
292
- let commentMarkersToFind = 1 ;
293
- newVNode . _excess = [ found ] ;
291
+ let commentMarkersToFind = 1 ,
292
+ index = excessDomChildren . indexOf ( found ) + 1 ;
293
+ newVNode . _component . _excess = [ ] ;
294
+ // Clear the comment marker so we don't reuse them for sibling
295
+ // Suspenders.
294
296
excessDomChildren [ index - 1 ] = null ;
297
+
295
298
while ( commentMarkersToFind && index <= excessDomChildren . length ) {
296
299
const node = excessDomChildren [ index ] ;
297
300
excessDomChildren [ index ] = null ;
298
301
index ++ ;
299
- newVNode . _excess . push ( node ) ;
302
+ // node being undefined here would be a problem as it would
303
+ // imply that we have a mismatch.
300
304
if ( node . nodeType == 8 ) {
301
305
if ( node . data == '$s' ) {
302
306
commentMarkersToFind ++ ;
303
307
} else if ( node . data == '/$s' ) {
304
308
commentMarkersToFind -- ;
305
309
}
310
+ } else {
311
+ newVNode . _component . _excess . push ( node ) ;
306
312
}
307
313
}
308
314
} else {
0 commit comments