mirror of https://github.com/sveltejs/svelte
commit
0ead405f2d
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: avoid false-positive batch invariant error
|
||||
@ -0,0 +1,16 @@
|
||||
import { tick } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
// This test mainly checks that we don't run into the 'Batch has scheduled roots' invariant wrongly.
|
||||
// It is crafted such that two batches are scheduled to run in the same microtask, and the first
|
||||
// tries to rebase the second.
|
||||
async test({ assert, target }) {
|
||||
await tick();
|
||||
const [run] = target.querySelectorAll('button');
|
||||
|
||||
run.click();
|
||||
await tick();
|
||||
assert.htmlEqual(target.innerHTML, '<button>run</button> none none 0');
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
let selectedId = $state(1);
|
||||
let selectedOption = $derived(selectedId ? await selectedId : null);
|
||||
</script>
|
||||
|
||||
<button onclick={() => (selectedId = null)}>run</button>
|
||||
|
||||
{selectedId ?? "none"} {selectedOption ?? "none"} {$effect.pending()}
|
||||
Loading…
Reference in new issue