fix: avoid false-positive batch invariant error (#18246)
Thanks to https://github.com/sveltejs/svelte/issues/17940#issuecomment-4480016550 I was finally able to isolate and reproduce a false-positive invariant error. I had a hunch this could happen and this shows it. Essentially, you can end up in situations where two batches are scheduled to run in the same microtask queue flush, and if the first rebases the second the invariant will throw, which is wrong. We can avoid this by checking if a decrement is queued.
S
Simon H committed
d654db83ef3c299e0b7833e6c418ce02d6127abd
Parent: 000c594
Committed by GitHub <noreply@github.com>
on 5/20/2026, 1:04:31 AM