Skip to content

Commit 92f7052

Browse files
committed
only call without_reactive_context when the controller exists
1 parent 3ca469a commit 92f7052

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/svelte/src/internal/client/reactivity/effects.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,13 @@ export function destroy_effect_children(signal, remove_dom = false) {
407407
signal.first = signal.last = null;
408408

409409
while (effect !== null) {
410-
without_reactive_context(() => {
411-
/** @type {Effect} */ (effect).ac?.abort(STALE_REACTION);
412-
});
410+
const controller = effect.ac;
411+
412+
if (controller !== null) {
413+
without_reactive_context(() => {
414+
controller.abort(STALE_REACTION);
415+
});
416+
}
413417

414418
var next = effect.next;
415419

packages/svelte/src/internal/client/runtime.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ export function update_reaction(reaction) {
282282
without_reactive_context(() => {
283283
/** @type {AbortController} */ (reaction.ac).abort(STALE_REACTION);
284284
});
285+
285286
reaction.ac = null;
286287
}
287288

0 commit comments

Comments
 (0)