mirror of https://github.com/sveltejs/svelte
fix: ensure topological order for render effects (#10175)
* fix: ensure topological order for render effects * optimizepull/10164/head
parent
d5cab3cb28
commit
c628904861
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: ensure topological order for render effects
|
@ -0,0 +1,16 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: `<button>Click</button><p>expires in 1 click</p>`,
|
||||
|
||||
async test({ assert, target }) {
|
||||
const [btn1] = target.querySelectorAll('button');
|
||||
|
||||
flushSync(() => {
|
||||
btn1.click();
|
||||
});
|
||||
|
||||
assert.htmlEqual(target.innerHTML, ``);
|
||||
}
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
let data = $state({ num: 1 });
|
||||
|
||||
function expire() {
|
||||
data.num = data.num - 1;
|
||||
if (data.num <= 0) data = undefined;
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if data}
|
||||
<button onclick={expire}>Click</button>
|
||||
<p>expires in {data.num} click</p>
|
||||
{/if}
|
Loading…
Reference in new issue