diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index e460fadb12..b8d9f851cf 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -811,7 +811,6 @@ export function schedule_effect(signal) { */ function process_effects(effect, collected_effects, boundary) { var current_effect = effect.first; - var effects = []; main_loop: while (current_effect !== null) { var flags = current_effect.f; @@ -832,34 +831,32 @@ function process_effects(effect, collected_effects, boundary) { // no more async work to happen b.commit(); } - } else if ((flags & RENDER_EFFECT) !== 0) { - if (is_branch) { - current_effect.f ^= CLEAN; - } else { - // Ensure we set the effect to be the active reaction - // to ensure that unowned deriveds are correctly tracked - // because we're flushing the current effect - var previous_active_reaction = active_reaction; - try { - active_reaction = current_effect; - if (check_dirtiness(current_effect)) { - update_effect(current_effect); - } - } catch (error) { - handle_error(error, current_effect, null, current_effect.ctx); - } finally { - active_reaction = previous_active_reaction; + } else if ((flags & EFFECT) !== 0) { + collected_effects.push(current_effect); + } else if (is_branch) { + current_effect.f ^= CLEAN; + } else { + // Ensure we set the effect to be the active reaction + // to ensure that unowned deriveds are correctly tracked + // because we're flushing the current effect + var previous_active_reaction = active_reaction; + try { + active_reaction = current_effect; + if (check_dirtiness(current_effect)) { + update_effect(current_effect); } + } catch (error) { + handle_error(error, current_effect, null, current_effect.ctx); + } finally { + active_reaction = previous_active_reaction; } + } - var child = current_effect.first; + var child = current_effect.first; - if (child !== null) { - current_effect = child; - continue; - } - } else if ((flags & EFFECT) !== 0) { - effects.push(current_effect); + if (child !== null) { + current_effect = child; + continue; } } @@ -882,14 +879,6 @@ function process_effects(effect, collected_effects, boundary) { current_effect = sibling; } - - // 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++) { - child = effects[i]; - collected_effects.push(child); - process_effects(child, collected_effects); - } } /**