Explorar o código

fix(compiler-core/v-on): only cache empty handler when the option is used

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.
Evan You %!s(int64=5) %!d(string=hai) anos
pai
achega
5fbd1f4ccb
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      packages/compiler-core/src/transforms/vOn.ts

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

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