Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-core): fix missed updates when passing text vnode to <component :is> #8304

11 changes: 11 additions & 0 deletions packages/runtime-core/__tests__/vnode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ describe('vnode', () => {
})
})

test('create from an existing text vnode', () => {
const vnode1 = createVNode('div', null, 'text', PatchFlags.TEXT)
const vnode2 = createVNode(vnode1)
expect(vnode2).toMatchObject({
type: 'div',
patchFlag: PatchFlags.BAIL,
children: 'text',
shapeFlag: ShapeFlags.ELEMENT | ShapeFlags.TEXT_CHILDREN,
})
})

test('vnode keys', () => {
for (const key of ['', 'a', 0, 1, NaN]) {
expect(createVNode('div', { key }).key).toBe(key)
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/vnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ function _createVNode(
currentBlock.push(cloned)
}
}
cloned.patchFlag |= PatchFlags.BAIL
cloned.patchFlag = PatchFlags.BAIL
return cloned
}

Expand Down