File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
packages/svelte/src/internal/client/reactivity Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -183,8 +183,14 @@ export function update_derived(derived) {
183183 // cleanup function, or it will cache a stale value
184184 if ( is_destroying_effect ) return ;
185185
186- var status =
187- ( skip_reaction || ( derived . f & UNOWNED ) !== 0 ) && derived . deps !== null ? MAYBE_DIRTY : CLEAN ;
186+ // only mark unowned deriveds as MAYBE_DIRTY if they have dependencies, otherwise they
187+ // must be clean regardless of the value of the skip_reaction flag value set for the previous_reaction
188+ // because not marking a regular derived as CLEAN will cause incosistent state when chaining
189+ // multiple derivides in which the top-most derived is marked MAYBE_DIRTY and all the ones that depends
190+ // on it are instead marked as CLEAN causing issues with properly updating the UI when the source state
191+ // is updated because the MAYBE_DIRTY derived is skipped and as a consequence also
192+ // the other deriveds (aka its reactions) are skipped as well.
193+ var status = ( derived . f & UNOWNED ) !== 0 && derived . deps !== null ? MAYBE_DIRTY : CLEAN ;
188194
189195 set_signal_status ( derived , status ) ;
190196}
You can’t perform that action at this time.
0 commit comments