Skip to content

Commit

Permalink
fix(compiler-core/v-on): only cache empty handler when the option is …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
yyx990803 committed Jul 27, 2020
1 parent c930f2e commit 5fbd1f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/compiler-core/src/transforms/vOn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 5fbd1f4

Please sign in to comment.