Skip to content

fix: preserve dirty status of deferred effects #16487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 24, 2025
Merged
Changes from 1 commit
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
Next Next commit
don't mark_reactions inside decrement, it can cause infinite loops
  • Loading branch information
Rich-Harris committed Jul 24, 2025
commit 2d089ebe0ade37357e6bcd6a0bbf055a23066b63
23 changes: 19 additions & 4 deletions packages/svelte/src/internal/client/reactivity/batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,13 @@ export class Batch {
if (is_branch) {
effect.f ^= CLEAN;
} else if ((flags & EFFECT) !== 0) {
this.#effects.push(effect);
if ((flags & CLEAN) === 0) {
this.#effects.push(effect);
}
} else if (async_mode_flag && (flags & RENDER_EFFECT) !== 0) {
this.#render_effects.push(effect);
if ((flags & CLEAN) === 0) {
this.#render_effects.push(effect);
}
} else if (is_dirty(effect)) {
if ((flags & ASYNC) !== 0) {
var effects = effect.b?.pending ? this.#boundary_async_effects : this.#async_effects;
Expand Down Expand Up @@ -380,8 +384,19 @@ export class Batch {
this.#pending -= 1;

if (this.#pending === 0) {
for (const source of this.current.keys()) {
mark_reactions(source, DIRTY, false);
for (const e of this.#render_effects) {
set_signal_status(e, DIRTY);
schedule_effect(e);
}

for (const e of this.#effects) {
set_signal_status(e, DIRTY);
schedule_effect(e);
}

for (const e of this.#block_effects) {
set_signal_status(e, DIRTY);
schedule_effect(e);
}

this.#render_effects = [];
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy