@@ -100,17 +100,17 @@ export function set_active_effect(effect) {
100100/**
101101 * When sources are created within a reaction, reading and writing
102102 * them within that reaction should not cause a re-run
103- * @type {null | [active_reaction : Reaction, sources: Source[]] }
103+ * @type {null | { reaction : Reaction, sources: Source[] } }
104104 */
105- export let reaction_sources = null ;
105+ export let source_ownership = null ;
106106
107107/** @param {Value } value */
108108export function push_reaction_value ( value ) {
109109 if ( active_reaction !== null && active_reaction . f & EFFECT_IS_UPDATING ) {
110- if ( reaction_sources === null ) {
111- reaction_sources = [ active_reaction , [ value ] ] ;
110+ if ( source_ownership === null ) {
111+ source_ownership = { reaction : active_reaction , sources : [ value ] } ;
112112 } else {
113- reaction_sources [ 1 ] . push ( value ) ;
113+ source_ownership . sources . push ( value ) ;
114114 }
115115 }
116116}
@@ -255,10 +255,11 @@ function schedule_possible_effect_self_invalidation(signal, effect, root = true)
255255
256256 if (
257257 ! async_mode_flag &&
258- reaction_sources ?. [ 1 ] . includes ( signal ) &&
259- reaction_sources [ 0 ] === active_reaction
260- )
258+ source_ownership ?. reaction === active_reaction &&
259+ source_ownership . sources . includes ( signal )
260+ ) {
261261 continue ;
262+ }
262263
263264 if ( ( reaction . f & DERIVED ) !== 0 ) {
264265 schedule_possible_effect_self_invalidation ( /** @type {Derived } */ ( reaction ) , effect , false ) ;
@@ -280,7 +281,7 @@ export function update_reaction(reaction) {
280281 var previous_untracked_writes = untracked_writes ;
281282 var previous_reaction = active_reaction ;
282283 var previous_skip_reaction = skip_reaction ;
283- var previous_reaction_sources = reaction_sources ;
284+ var previous_reaction_sources = source_ownership ;
284285 var previous_component_context = component_context ;
285286 var previous_untracking = untracking ;
286287
@@ -293,7 +294,7 @@ export function update_reaction(reaction) {
293294 ( flags & UNOWNED ) !== 0 && ( untracking || ! is_updating_effect || active_reaction === null ) ;
294295 active_reaction = ( flags & ( BRANCH_EFFECT | ROOT_EFFECT ) ) === 0 ? reaction : null ;
295296
296- reaction_sources = null ;
297+ source_ownership = null ;
297298 set_component_context ( reaction . ctx ) ;
298299 untracking = false ;
299300 read_version ++ ;
@@ -389,7 +390,7 @@ export function update_reaction(reaction) {
389390 untracked_writes = previous_untracked_writes ;
390391 active_reaction = previous_reaction ;
391392 skip_reaction = previous_skip_reaction ;
392- reaction_sources = previous_reaction_sources ;
393+ source_ownership = previous_reaction_sources ;
393394 set_component_context ( previous_component_context ) ;
394395 untracking = previous_untracking ;
395396
@@ -804,8 +805,8 @@ export function get(signal) {
804805 if (
805806 ! destroyed &&
806807 ( ( async_mode_flag && ( active_reaction . f & DERIVED ) === 0 ) ||
807- ! reaction_sources ?. [ 1 ] . includes ( signal ) ||
808- reaction_sources [ 0 ] !== active_reaction )
808+ source_ownership ?. reaction !== active_reaction ||
809+ ! source_ownership ?. sources . includes ( signal ) )
809810 ) {
810811 var deps = active_reaction . deps ;
811812
0 commit comments