@@ -373,20 +373,24 @@ export function createPatchFunction (backend) {
373
373
}
374
374
375
375
function assertNodeMatch ( node , vnode ) {
376
- if ( vnode . tag ) {
377
- if ( vnode . tag . indexOf ( 'vue-component' ) === 0 ) {
378
- return true
379
- } else {
380
- const childNodes = nodeOps . childNodes ( node )
381
- return vnode . tag === nodeOps . tagName ( node ) . toLowerCase ( ) && (
382
- vnode . children
383
- ? vnode . children . length === childNodes . length
384
- : childNodes . length === 0
385
- )
386
- }
376
+ let match = true
377
+ if ( ! node ) {
378
+ match = false
379
+ } else if ( vnode . tag ) {
380
+ match =
381
+ vnode . tag . indexOf ( 'vue-component' ) === 0 ||
382
+ vnode . tag === nodeOps . tagName ( node ) . toLowerCase ( )
387
383
} else {
388
- return _toString ( vnode . text ) === node . data
384
+ match = _toString ( vnode . text ) === node . data
385
+ }
386
+ if ( process . env . NODE_ENV !== 'production' && ! match ) {
387
+ warn (
388
+ 'The client-side rendered virtual DOM tree is not matching ' +
389
+ 'server-rendered content. Bailing hydration and performing ' +
390
+ 'full client-side render.'
391
+ )
389
392
}
393
+ return match
390
394
}
391
395
392
396
return function patch ( oldVnode , vnode , hydrating , removeOnly ) {
@@ -415,12 +419,6 @@ export function createPatchFunction (backend) {
415
419
if ( hydrate ( oldVnode , vnode , insertedVnodeQueue ) ) {
416
420
invokeInsertHook ( vnode , insertedVnodeQueue , true )
417
421
return oldVnode
418
- } else if ( process . env . NODE_ENV !== 'production' ) {
419
- warn (
420
- 'The client-side rendered virtual DOM tree is not matching ' +
421
- 'server-rendered content. Bailing hydration and performing ' +
422
- 'full client-side render.'
423
- )
424
422
}
425
423
}
426
424
// either not server-rendered, or hydration failed.
0 commit comments