Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/svelte/src/internal/client/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { handle_error, invoke_error_boundary } from './error-handling.js';
import { UNINITIALIZED } from '../../constants.js';

let is_flushing = false;
let is_flushing_root_effects = false;

/** @type {Effect | null} */
let last_scheduled_effect = null;
Expand Down Expand Up @@ -548,6 +549,7 @@ function flush_queued_root_effects() {
try {
var flush_count = 0;
is_updating_effect = true;
is_flushing_root_effects = true;

while (queued_root_effects.length > 0) {
if (flush_count++ > 1000) {
Expand All @@ -568,6 +570,7 @@ function flush_queued_root_effects() {
} finally {
is_flushing = false;
is_updating_effect = was_updating_effect;
is_flushing_root_effects = false;

last_scheduled_effect = null;
if (DEV) {
Expand Down Expand Up @@ -638,6 +641,10 @@ export function schedule_effect(signal) {
effect = effect.parent;
var flags = effect.f;

if (effect === active_effect && (flags & BLOCK_EFFECT) !== 0 && is_flushing_root_effects) {
return;
}

if ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
if ((flags & CLEAN) === 0) return;
effect.f ^= CLEAN;
Expand Down