Skip to content

Commit b310ec3

Browse files
authored
fix(runtime-core): fix missed updates when passing text vnode to <component :is> (#8304)
close #8298
1 parent 3b0a56a commit b310ec3

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/runtime-core/__tests__/vnode.spec.ts

+11
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ describe('vnode', () => {
6363
})
6464
})
6565

66+
test('create from an existing text vnode', () => {
67+
const vnode1 = createVNode('div', null, 'text', PatchFlags.TEXT)
68+
const vnode2 = createVNode(vnode1)
69+
expect(vnode2).toMatchObject({
70+
type: 'div',
71+
patchFlag: PatchFlags.BAIL,
72+
children: 'text',
73+
shapeFlag: ShapeFlags.ELEMENT | ShapeFlags.TEXT_CHILDREN,
74+
})
75+
})
76+
6677
test('vnode keys', () => {
6778
for (const key of ['', 'a', 0, 1, NaN]) {
6879
expect(createVNode('div', { key }).key).toBe(key)

packages/runtime-core/src/vnode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ function _createVNode(
549549
currentBlock.push(cloned)
550550
}
551551
}
552-
cloned.patchFlag |= PatchFlags.BAIL
552+
cloned.patchFlag = PatchFlags.BAIL
553553
return cloned
554554
}
555555

0 commit comments

Comments
 (0)