Skip to content

Commit

Permalink
fix(compiler-core): should not hoist element with cached + merged eve…
Browse files Browse the repository at this point in the history
…nt handlers
  • Loading branch information
yyx990803 committed Feb 13, 2020
1 parent 9aaef60 commit 5455e8e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/compiler-core/src/transforms/hoistStatic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 5455e8e

Please sign in to comment.