mirror of https://github.com/sveltejs/svelte
parent
3dde011d3a
commit
17db18f708
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: block template store subscriptions on the promise that assigns the store
|
||||
@ -0,0 +1,13 @@
|
||||
import { tick } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
// Tests that a store subscription only present in the template waits for the
|
||||
// promise that assigns the store instead of subscribing to `undefined`.
|
||||
export default test({
|
||||
mode: ['client', 'hydrate', 'async-server'],
|
||||
ssrHtml: '<p>hello</p>',
|
||||
async test({ assert, target }) {
|
||||
await tick();
|
||||
assert.htmlEqual(target.innerHTML, '<p>hello</p>');
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,11 @@
|
||||
<script>
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
async function get_store() {
|
||||
return writable('hello');
|
||||
}
|
||||
|
||||
const store = await get_store();
|
||||
</script>
|
||||
|
||||
<p>{$store}</p>
|
||||
Loading…
Reference in new issue