mirror of https://github.com/sveltejs/svelte
This makes flushing effects much faster in scenarios where there's a lot of effects and many of the write to state. We added this "bail and reschedule" mechanism mainly to prevent subsequent effects from being called when a prior effect execution did e.g. cause an if block to become false and the effect about to run next therefore being destroyed. This change addresses that issue by flushing the newly created batch right away, but only executing its branches. Through this we also get rid of the false-positive loop protection error. The one downside is that effect execution ordering is slightly different: Only things scheduled within the current batch are executed in order, all new (pre-)effects will run afterwards. The worst thing that can happen as a result is rerunning render or user effects more often than they need to, but I expect this to be minimal in comparison to the perf wins. Fixes #16548pull/16612/head
parent
2e02868ef1
commit
7e4064c875
Loading…
Reference in new issue