]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): fix missed updates when passing text vnode to `<component :is...
authorauvred <61150013+auvred@users.noreply.github.com>
Wed, 5 Jun 2024 15:08:46 +0000 (18:08 +0300)
committerGitHub <noreply@github.com>
Wed, 5 Jun 2024 15:08:46 +0000 (23:08 +0800)
close #8298

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

index 29f5a042cc9e88c3ac53a6bdfc348897c9cd40f2..39a7abd5f89995fa2127f0b1c4256b1889b6e587 100644 (file)
@@ -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)
index 3d30503e20a90a8c404d3d1c657303c7988d727f..d91532fb37701f8d5a04f04ed86bcd43902d7dbc 100644 (file)
@@ -549,7 +549,7 @@ function _createVNode(
         currentBlock.push(cloned)
       }
     }
-    cloned.patchFlag |= PatchFlags.BAIL
+    cloned.patchFlag = PatchFlags.BAIL
     return cloned
   }