mirror of https://github.com/sveltejs/svelte
fix: don't hoist listeners that access non hoistable snippets (#15534)
* fix: don't hoist listeners that access non hoistable snippets * chore: add comment * chore: fix auto import fumblepull/15536/head
parent
74917ae703
commit
5b9f0df8ee
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: don't hoist listeners that access non hoistable snippets
|
@ -0,0 +1,12 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
async test({ assert, target, errors }) {
|
||||
const button = target.querySelector('button');
|
||||
flushSync(() => {
|
||||
button?.click();
|
||||
});
|
||||
assert.deepEqual(errors, []);
|
||||
}
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
<script>
|
||||
const log = () => {
|
||||
console.log(snip);
|
||||
}
|
||||
let x = $state(0);
|
||||
</script>
|
||||
|
||||
<button onclick={log}></button>
|
||||
|
||||
{#snippet snip()}
|
||||
snippet {x}
|
||||
{/snippet}
|
Loading…
Reference in new issue