Skip to content

Commit da18260

Browse files
committed
fix
1 parent 0d429c6 commit da18260

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

packages/svelte/src/internal/client/dom/elements/transitions.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ import { current_each_item } from '../blocks/each.js';
1414
import { TRANSITION_GLOBAL, TRANSITION_IN, TRANSITION_OUT } from '../../../../constants.js';
1515
import { BLOCK_EFFECT, EFFECT_RAN, EFFECT_TRANSPARENT } from '../../constants.js';
1616
import { queue_micro_task } from '../task.js';
17+
import { without_reactive_context } from './bindings/shared.js';
1718

1819
/**
1920
* @param {Element} element
2021
* @param {'introstart' | 'introend' | 'outrostart' | 'outroend'} type
2122
* @returns {void}
2223
*/
2324
function dispatch_event(element, type) {
24-
element.dispatchEvent(new CustomEvent(type));
25+
without_reactive_context(() => {
26+
element.dispatchEvent(new CustomEvent(type));
27+
});
2528
}
2629

2730
/**

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

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -369,33 +369,18 @@ export function handle_error(error, effect, previous_effect, component_context)
369369
/**
370370
* @param {Value} signal
371371
* @param {Effect} effect
372-
* @param {number} [depth]
372+
* @param {boolean} [root]
373373
*/
374-
function schedule_possible_effect_self_invalidation(
375-
signal,
376-
effect,
377-
depth = 0,
378-
visited = new Set()
379-
) {
374+
function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
380375
var reactions = signal.reactions;
381376
if (reactions === null) return;
382377

383378
for (var i = 0; i < reactions.length; i++) {
384379
var reaction = reactions[i];
385-
if (visited.has(reaction)) {
386-
continue;
387-
}
388-
visited.add(reaction);
389-
390380
if ((reaction.f & DERIVED) !== 0) {
391-
schedule_possible_effect_self_invalidation(
392-
/** @type {Derived} */ (reaction),
393-
effect,
394-
depth + 1,
395-
visited
396-
);
381+
schedule_possible_effect_self_invalidation(/** @type {Derived} */ (reaction), effect, false);
397382
} else if (effect === reaction) {
398-
if (depth === 0) {
383+
if (root) {
399384
set_signal_status(reaction, DIRTY);
400385
} else if ((reaction.f & CLEAN) !== 0) {
401386
set_signal_status(reaction, MAYBE_DIRTY);

0 commit comments

Comments
 (0)