]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-core/v-on): only cache empty handler when the option is used
authorEvan You <yyx990803@gmail.com>
Mon, 27 Jul 2020 22:26:47 +0000 (18:26 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 27 Jul 2020 22:28:39 +0000 (18:28 -0400)
fix #1716

The original idea is that the empty handler can be cached in all cases,
but this contradicts with the assumption that `hasCachedProps` check in
the static hoist transform can simply return `false` in the browser
build.

packages/compiler-core/src/transforms/vOn.ts

index 75759708bd382a0ecbb17af9d096e469460a49a1..9bd5b2a46e0223bab8c6e96ac2e79b9a3b807d12 100644 (file)
@@ -68,7 +68,7 @@ export const transformOn: DirectiveTransform = (
   if (exp && !exp.content.trim()) {
     exp = undefined
   }
-  let isCacheable: boolean = !exp
+  let isCacheable: boolean = context.cacheHandlers && !exp
   if (exp) {
     const isMemberExp = isMemberExpression(exp.content)
     const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content))