File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
packages/svelte/src/internal/client Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -194,9 +194,21 @@ export function check_dirtiness(reaction) {
194
194
// is also dirty.
195
195
var version = dependency . version ;
196
196
197
- if ( is_unowned && version > /** @type {import('#client').Derived } */ ( reaction ) . version ) {
198
- /** @type {import('#client').Derived } */ ( reaction ) . version = version ;
199
- return true ;
197
+ if ( is_unowned ) {
198
+ if ( version > /** @type {import('#client').Derived } */ ( reaction ) . version ) {
199
+ /** @type {import('#client').Derived } */ ( reaction ) . version = version ;
200
+ return true ;
201
+ } else if ( ! current_skip_reaction && ! dependency ?. reactions ?. includes ( reaction ) ) {
202
+ // If we are working with an unowned signal as part of an effect (due to !current_skip_reaction)
203
+ // and the version hasn't changed, we still need to check that this reaction
204
+ // if linked to the dependency source – otherwise future updates will not be caught.
205
+ var reactions = dependency . reactions ;
206
+ if ( reactions === null ) {
207
+ dependency . reactions = [ reaction ] ;
208
+ } else {
209
+ reactions . push ( reaction ) ;
210
+ }
211
+ }
200
212
}
201
213
}
202
214
}
You can’t perform that action at this time.
0 commit comments