Skip to content

Commit 5455e8e

Browse files
committed
fix(compiler-core): should not hoist element with cached + merged event handlers
1 parent 9aaef60 commit 5455e8e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

+11-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,17 @@ function hasCachedProps(node: PlainElementNode): boolean {
176176
if (props && props.type === NodeTypes.JS_OBJECT_EXPRESSION) {
177177
const { properties } = props
178178
for (let i = 0; i < properties.length; i++) {
179-
if (properties[i].value.type === NodeTypes.JS_CACHE_EXPRESSION) {
179+
const val = properties[i].value
180+
if (val.type === NodeTypes.JS_CACHE_EXPRESSION) {
181+
return true
182+
}
183+
// merged event handlers
184+
if (
185+
val.type === NodeTypes.JS_ARRAY_EXPRESSION &&
186+
val.elements.some(
187+
e => !isString(e) && e.type === NodeTypes.JS_CACHE_EXPRESSION
188+
)
189+
) {
180190
return true
181191
}
182192
}

0 commit comments

Comments
 (0)