fix: avoid declaration tag warning in event handlers (#18500)

Closes #18493

Co-authored-by: justjavac <justjavac@gmail.com>
main
Paolo Ricciuti 10 hours ago committed by GitHub
parent 8fb7ceeba5
commit 41642b70ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: avoid declaration tag warning in event handlers

@ -18,7 +18,9 @@ export function visit_function(node, context) {
context.next({
...context.state,
function_depth: context.state.function_depth + 1,
// we generally want to use scope.function_depth unless we specifically increased
// that in state.function_depth (e.g. a derived)
function_depth: Math.max(context.state.scope.function_depth, context.state.function_depth) + 1,
expression: null
});
}

@ -7,3 +7,7 @@
{let e = $state(0), f = e}
{a}{b}{c}{d}{e}{f}
<button onclick={() => {
console.log(a);
}}>a</button>
Loading…
Cancel
Save