File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
packages/svelte/src/internal/client/reactivity Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -360,7 +360,9 @@ export function update_derived(derived) {
360360 // the underlying value will be updated when the fork is committed.
361361 // otherwise, the next time we get here after a 'real world' state
362362 // change, `derived.equals` may incorrectly return `true`
363- if ( ! current_batch ?. is_fork ) {
363+ // Exception: deriveds with no deps should always update `derived.v`
364+ // since they will never change and need the value after fork commits
365+ if ( ! current_batch ?. is_fork || derived . deps === null ) {
364366 derived . v = value ;
365367 }
366368
@@ -381,6 +383,11 @@ export function update_derived(derived) {
381383 if ( effect_tracking ( ) || current_batch ?. is_fork ) {
382384 batch_values . set ( derived , value ) ;
383385 }
386+ // For deriveds with no deps, set CLEAN to prevent re-evaluation
387+ // since they can never become dirty from dependency changes
388+ if ( derived . deps === null ) {
389+ set_signal_status ( derived , CLEAN ) ;
390+ }
384391 } else {
385392 var status = ( derived . f & CONNECTED ) === 0 ? MAYBE_DIRTY : CLEAN ;
386393 set_signal_status ( derived , status ) ;
You can’t perform that action at this time.
0 commit comments