mirror of https://github.com/sveltejs/svelte
fix: ensure `$store` reads are properly transformed (#12952)
The backing store variable of a $store read could be a variable that itself needs a transformer, which is why we need to make accessing the reads lazy fixes #12859pull/12957/head
parent
732dbf7fa9
commit
af7f90020d
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: ensure `$store` reads are properly transformed
|
@ -0,0 +1,11 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: `<button>false</button>`,
|
||||
test({ assert, target }) {
|
||||
target.querySelector('button')?.click();
|
||||
flushSync();
|
||||
assert.htmlEqual(target.innerHTML, `<button>true</button>`);
|
||||
}
|
||||
});
|
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
import { writable } from 'svelte/store';
|
||||
let data = { store: writable(false) };
|
||||
let { store } = $derived(data);
|
||||
</script>
|
||||
|
||||
<button onclick={() => ($store = true)}>{$store}</button>
|
Loading…
Reference in new issue