File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
packages/svelte/src/internal/client Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments