]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): clone root vnode before inheriting directives
authorEvan You <yyx990803@gmail.com>
Thu, 12 May 2022 23:29:28 +0000 (07:29 +0800)
committerEvan You <yyx990803@gmail.com>
Thu, 12 May 2022 23:29:37 +0000 (07:29 +0800)
packages/runtime-core/src/componentRenderUtils.ts

index ce03b4f6af055f410228f82dc6e90673f85229df..8e338c31d6c64c5d0d001a82f664460392b73b1a 100644 (file)
@@ -215,6 +215,8 @@ export function renderComponentRoot(
           `The directives will not function as intended.`
       )
     }
+    // clone before mutating since the root may be a hoisted vnode
+    root = cloneVNode(root)
     root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs
   }
   // inherit transition data