mirror of https://github.com/vuejs/core.git
fix(runtime-core): handle fragment with null children (#10010)
close #10007
This commit is contained in:
parent
3c3561e720
commit
3bf34b767e
|
@ -351,4 +351,16 @@ describe('renderer: fragment', () => {
|
|||
render(renderFn(['two', 'one']), root)
|
||||
expect(serializeInner(root)).toBe(`text<div>two</div>text<div>one</div>`)
|
||||
})
|
||||
|
||||
// #10007
|
||||
test('empty fragment', () => {
|
||||
const root = nodeOps.createElement('div')
|
||||
|
||||
const renderFn = () => {
|
||||
return openBlock(true), createBlock(Fragment, null)
|
||||
}
|
||||
|
||||
render(renderFn(), root)
|
||||
expect(serializeInner(root)).toBe('')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1086,7 +1086,11 @@ function baseCreateRenderer(
|
|||
// since they are either generated by the compiler, or implicitly created
|
||||
// from arrays.
|
||||
mountChildren(
|
||||
n2.children as VNodeArrayChildren,
|
||||
// #10007
|
||||
// such fragment like `<></>` will be compiled into
|
||||
// a fragment which doesn't have a children.
|
||||
// In this case fallback to an empty array
|
||||
(n2.children || []) as VNodeArrayChildren,
|
||||
container,
|
||||
fragmentEndAnchor,
|
||||
parentComponent,
|
||||
|
|
Loading…
Reference in New Issue