Better process effects (#11560)

* fix: improve internal mechanism for handling process_effects
pull/11561/head
Dominic Gannaway 8 months ago committed by GitHub
parent 4cadd07676
commit 643bbf2be2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: improve internal mechanism for handling process_effects

@ -653,12 +653,13 @@ function process_effects(effect, filter_flags, shallow, collected_effects) {
}
if (effects.length > 0) {
// We might be dealing with many effects here, far more than can be spread into
// an array push call (callstack overflow). So let's deal with each effect in a loop.
for (var i = 0; i < effects.length; i++) {
if ((filter_flags & EFFECT) !== 0) {
collected_effects.push(...effects);
collected_effects.push(effects[i]);
}
if (!shallow) {
for (var i = 0; i < effects.length; i++) {
process_effects(effects[i], filter_flags, false, collected_effects);
}
}
@ -677,7 +678,6 @@ function process_effects(effect, filter_flags, shallow, collected_effects) {
* @returns {void}
*/
function flush_nested_effects(effect, filter_flags, shallow = false) {
infinite_loop_guard();
/** @type {import('#client').Effect[]} */
var collected_effects = [];
@ -1163,7 +1163,7 @@ export function pop(component) {
const effects = context_stack_item.e;
if (effects !== null) {
context_stack_item.e = null;
for (let i = 0; i < effects.length; i++) {
for (var i = 0; i < effects.length; i++) {
effect(effects[i]);
}
}

Loading…
Cancel
Save