From 96b9c137d765bad90e8c402926631b51d521c7a4 Mon Sep 17 00:00:00 2001 From: auvred Date: Sat, 13 May 2023 00:30:39 +0000 Subject: [PATCH 1/4] fix(runtime-core): fix missed updates when passing text node to --- packages/runtime-core/src/vnode.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index a69b34ed941..dc0aa3324b7 100644 --- a/packages/runtime-core/src/vnode.ts +++ b/packages/runtime-core/src/vnode.ts @@ -537,7 +537,7 @@ function _createVNode( currentBlock.push(cloned) } } - cloned.patchFlag |= PatchFlags.BAIL + cloned.patchFlag = PatchFlags.BAIL return cloned } From 2cf0678fc14fd7331f6d6da15881e19ebeb26290 Mon Sep 17 00:00:00 2001 From: auvred Date: Fri, 20 Oct 2023 11:06:14 +0000 Subject: [PATCH 2/4] test: add test case --- packages/runtime-core/__tests__/vnode.spec.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/runtime-core/__tests__/vnode.spec.ts b/packages/runtime-core/__tests__/vnode.spec.ts index 02774aafee4..1bc4268e288 100644 --- a/packages/runtime-core/__tests__/vnode.spec.ts +++ b/packages/runtime-core/__tests__/vnode.spec.ts @@ -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) From 2d89f91485635e057b60e9bb40a4782a1dec9945 Mon Sep 17 00:00:00 2001 From: auvred Date: Fri, 20 Oct 2023 11:19:45 +0000 Subject: [PATCH 3/4] chore: trigger deploy From f19953c3d556d105f570bed46a7d000bd008c0c8 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Fri, 19 Jan 2024 14:20:27 +0000 Subject: [PATCH 4/4] [autofix.ci] apply automated fixes --- packages/runtime-core/__tests__/vnode.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runtime-core/__tests__/vnode.spec.ts b/packages/runtime-core/__tests__/vnode.spec.ts index affa34a0def..dab7e827d32 100644 --- a/packages/runtime-core/__tests__/vnode.spec.ts +++ b/packages/runtime-core/__tests__/vnode.spec.ts @@ -70,7 +70,7 @@ describe('vnode', () => { type: 'div', patchFlag: PatchFlags.BAIL, children: 'text', - shapeFlag: ShapeFlags.ELEMENT | ShapeFlags.TEXT_CHILDREN + shapeFlag: ShapeFlags.ELEMENT | ShapeFlags.TEXT_CHILDREN, }) })