File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
packages/svelte/src/internal/client Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -424,24 +424,24 @@ export function update_reaction(reaction) {
424424 reaction . deps = deps = new_deps ;
425425 }
426426
427- for ( i = skipped_deps ; i < deps . length ; i ++ ) {
428- var dep = deps [ i ] ;
429- if ( ! skip_reaction ) {
430- ( dep . reactions ??= [ ] ) . push ( reaction ) ;
427+ if ( ! skip_reaction ) {
428+ for ( i = skipped_deps ; i < deps . length ; i ++ ) {
429+ ( deps [ i ] . reactions ??= [ ] ) . push ( reaction ) ;
431430 }
432- // Reset read version back to 0. If we are
433- // returning to an previous reaction and
434- // it were to read this depedency too and we
435- // didn't reset the read version, then it would
436- // not be added as a dependency to that reaction
437- // as the global read version won't have changed
438- dep . rv = 0 ;
439431 }
440432 } else if ( deps !== null && skipped_deps < deps . length ) {
441433 remove_reactions ( reaction , skipped_deps ) ;
442434 deps . length = skipped_deps ;
443435 }
444436
437+ // If we are returning to an previous reaction then
438+ // we need to increment the read version to ensure that
439+ // any dependencies in this reaction aren't marked with
440+ // the same version
441+ if ( previous_reaction !== null ) {
442+ read_version ++ ;
443+ }
444+
445445 return result ;
446446 } finally {
447447 new_deps = previous_deps ;
You can’t perform that action at this time.
0 commit comments