File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
packages/svelte/src/internal/client/reactivity Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -185,15 +185,12 @@ export function user_effect(fn) {
185185 } ) ;
186186 }
187187
188- // Non-nested `$effect(...)` in a component should be deferred
189- // until the component is mounted
190- var defer =
191- active_effect !== null && ( active_effect . f & BRANCH_EFFECT ) !== 0 && active_reaction === null ;
192-
193- if ( defer ) {
188+ if ( ! active_reaction && active_effect && ( active_effect . f & BRANCH_EFFECT ) !== 0 ) {
189+ // Top-level `$effect(...)` in a component — defer until mount
194190 var context = /** @type {ComponentContext } */ ( component_context ) ;
195191 ( context . e ??= [ ] ) . push ( fn ) ;
196192 } else {
193+ // Everything else — create immediately
197194 return create_user_effect ( fn ) ;
198195 }
199196}
You can’t perform that action at this time.
0 commit comments