fix: skip deriveds for props with known safe calls (#11595)

pull/11580/head
Rich Harris 8 months ago committed by GitHub
parent faa2e937ab
commit b212b17385
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: skip deriveds for props with known safe calls

@ -1042,6 +1042,9 @@ function is_known_safe_call(node, context) {
return true;
}
}
// TODO add more cases
return false;
}
@ -1262,11 +1265,12 @@ const common_visitors = {
}
},
CallExpression(node, context) {
const { expression } = context.state;
if (
context.state.expression?.type === 'ExpressionTag' ||
(context.state.expression?.type === 'SpreadAttribute' && !is_known_safe_call(node, context))
(expression?.type === 'ExpressionTag' || expression?.type === 'SpreadAttribute') &&
!is_known_safe_call(node, context)
) {
context.state.expression.metadata.contains_call_expression = true;
expression.metadata.contains_call_expression = true;
}
const callee = node.callee;

Loading…
Cancel
Save