File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 9
9
Suspense ,
10
10
onMounted ,
11
11
defineAsyncComponent ,
12
- defineComponent
12
+ defineComponent ,
13
+ createTextVNode
13
14
} from '@vue/runtime-dom'
14
15
import { renderToString , SSRContext } from '@vue/server-renderer'
15
16
@@ -47,6 +48,14 @@ describe('SSR hydration', () => {
47
48
expect ( container . textContent ) . toBe ( 'bar' )
48
49
} )
49
50
51
+ test ( 'empty text' , async ( ) => {
52
+ const { container } = mountWithHydration ( '<div></div>' , ( ) =>
53
+ h ( 'div' , createTextVNode ( '' ) )
54
+ )
55
+ expect ( container . textContent ) . toBe ( '' )
56
+ expect ( `Hydration children mismatch in <div>` ) . not . toHaveBeenWarned ( )
57
+ } )
58
+
50
59
test ( 'comment' , ( ) => {
51
60
const { vnode, container } = mountWithHydration ( '<!---->' , ( ) => null )
52
61
expect ( vnode . el ) . toBe ( container . firstChild )
Original file line number Diff line number Diff line change @@ -359,6 +359,8 @@ export function createHydrationFunctions(
359
359
slotScopeIds ,
360
360
optimized
361
361
)
362
+ } else if ( vnode . type === Text && ! vnode . children ) {
363
+ continue
362
364
} else {
363
365
hasMismatch = true
364
366
if ( __DEV__ && ! hasWarned ) {
You can’t perform that action at this time.
0 commit comments