Skip to content

Commit 8bf08ff

Browse files
committed
consistency fix 2
1 parent 3614f37 commit 8bf08ff

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,13 @@ export function update_effect(effect) {
539539

540540
execute_effect_teardown(effect);
541541
var teardown = update_reaction(effect);
542+
var is_init = effect.version === 0;
542543
effect.teardown = typeof teardown === 'function' ? teardown : null;
543544

544-
// If unsafe() has been used within the effect, then we might need
545-
// to schedule another update for this effect in case the unsafe mutation
546-
// has caused a this effect to become invalidated again
547-
if (unsafe_mutation_inside_effect && (effect.f & CLEAN) !== 0) {
545+
// If unsafe() has been used within the effect on the first time
546+
// it's run, then we might need to schedule the effect to run again
547+
// if it has a dependency that has been invalidated
548+
if (unsafe_mutation_inside_effect && is_init && (effect.f & CLEAN) !== 0) {
548549
set_signal_status(effect, MAYBE_DIRTY);
549550
if (check_dirtiness(effect)) {
550551
set_signal_status(effect, DIRTY);

0 commit comments

Comments
 (0)