Explorar o código

fix(runtime-core): clone root vnode before inheriting directives

Evan You %!s(int64=4) %!d(string=hai) anos
pai
achega
d36ca4d80e
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      packages/runtime-core/src/componentRenderUtils.ts

+ 2 - 0
packages/runtime-core/src/componentRenderUtils.ts

@@ -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