]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-core): should not hoist element with cached + merged event handlers
authorEvan You <yyx990803@gmail.com>
Thu, 13 Feb 2020 23:34:08 +0000 (18:34 -0500)
committerEvan You <yyx990803@gmail.com>
Thu, 13 Feb 2020 23:34:08 +0000 (18:34 -0500)
packages/compiler-core/src/transforms/hoistStatic.ts

index da44a1ecb56f10de686ef21b470498a827a7bfbf..968fc59120d697d28b32ff6b0fcea1678d4002c8 100644 (file)
@@ -176,7 +176,17 @@ function hasCachedProps(node: PlainElementNode): boolean {
   if (props && props.type === NodeTypes.JS_OBJECT_EXPRESSION) {
     const { properties } = props
     for (let i = 0; i < properties.length; i++) {
-      if (properties[i].value.type === NodeTypes.JS_CACHE_EXPRESSION) {
+      const val = properties[i].value
+      if (val.type === NodeTypes.JS_CACHE_EXPRESSION) {
+        return true
+      }
+      // merged event handlers
+      if (
+        val.type === NodeTypes.JS_ARRAY_EXPRESSION &&
+        val.elements.some(
+          e => !isString(e) && e.type === NodeTypes.JS_CACHE_EXPRESSION
+        )
+      ) {
         return true
       }
     }