@@ -55,9 +55,6 @@ export let current_effect = null;
5555/** @type {null | import('./types.js').Signal[] } */
5656let current_dependencies = null ;
5757let current_dependencies_index = 0 ;
58- // Used to prevent over-subscribing dependencies on a consumer
59- let current_consumer_read_clock = 1 ;
60- let current_read_clock = 1 ;
6158// Handling capturing of signals from object property getters
6259let current_should_capture_signal = false ;
6360/** If `true`, `get`ting the signal should not register it as a dependency */
@@ -153,7 +150,6 @@ function create_signal_object(flags, value, block) {
153150 equals : null ,
154151 flags,
155152 init : null ,
156- read : 0 ,
157153 references : null ,
158154 value
159155 } ;
@@ -190,13 +186,15 @@ function is_signal_dirty(signal) {
190186 let i ;
191187 for ( i = 0 ; i < length ; i ++ ) {
192188 const dependency = dependencies [ i ] ;
189+ const dep_flags = dependency . flags ;
193190
194- if ( ( dependency . flags & MAYBE_DIRTY ) !== 0 && ! is_signal_dirty ( dependency ) ) {
191+ if ( ( dep_flags & MAYBE_DIRTY ) !== 0 && ! is_signal_dirty ( dependency ) ) {
195192 set_signal_status ( dependency , CLEAN ) ;
196193 continue ;
197194 }
198- if ( ( dependency . flags & DIRTY ) !== 0 || dependency . value === UNINITIALIZED ) {
199- if ( ( dependency . flags & DERIVED ) !== 0 ) {
195+ // The flags can be marked as dirty from the above is_signal_dirty call.
196+ if ( ( dependency . flags & DIRTY ) !== 0 ) {
197+ if ( ( dep_flags & DERIVED ) !== 0 ) {
200198 update_derived ( dependency , true ) ;
201199 // Might have been mutated from above get.
202200 if ( ( signal . flags & DIRTY ) !== 0 ) {
@@ -221,7 +219,6 @@ function execute_signal_fn(signal) {
221219 const init = signal . init ;
222220 const previous_dependencies = current_dependencies ;
223221 const previous_dependencies_index = current_dependencies_index ;
224- const previous_consumer_read_clock = current_consumer_read_clock ;
225222 const previous_consumer = current_consumer ;
226223 const previous_block = current_block ;
227224 const previous_component_context = current_component_context ;
@@ -230,12 +227,6 @@ function execute_signal_fn(signal) {
230227 const previous_untracking = current_untracking ;
231228 current_dependencies = /** @type {null | import('./types.js').Signal[] } */ ( null ) ;
232229 current_dependencies_index = 0 ;
233- if ( current_read_clock === MAX_SAFE_INT ) {
234- current_read_clock = 1 ;
235- } else {
236- current_read_clock ++ ;
237- }
238- current_consumer_read_clock = current_read_clock ;
239230 current_consumer = signal ;
240231 current_block = signal . block ;
241232 current_component_context = signal . context ;
@@ -290,7 +281,6 @@ function execute_signal_fn(signal) {
290281 } finally {
291282 current_dependencies = previous_dependencies ;
292283 current_dependencies_index = previous_dependencies_index ;
293- current_consumer_read_clock = previous_consumer_read_clock ;
294284 current_consumer = previous_consumer ;
295285 current_block = previous_block ;
296286 current_component_context = previous_component_context ;
@@ -427,7 +417,7 @@ function flush_queued_effects(effects) {
427417 for ( i = 0 ; i < length ; i ++ ) {
428418 const signal = effects [ i ] ;
429419 const flags = signal . flags ;
430- if ( ( flags & DESTROYED ) === 0 && ( flags & INERT ) === 0 ) {
420+ if ( ( flags & ( DESTROYED | INERT ) ) === 0 ) {
431421 if ( is_signal_dirty ( signal ) ) {
432422 set_signal_status ( signal , CLEAN ) ;
433423 execute_effect ( signal ) ;
@@ -744,12 +734,9 @@ export function get(signal) {
744734 current_dependencies_index ++ ;
745735 } else if ( current_dependencies === null ) {
746736 current_dependencies = [ signal ] ;
747- } else if ( signal . read !== current_consumer_read_clock ) {
737+ } else if ( signal !== current_dependencies . at ( - 1 ) ) {
748738 current_dependencies . push ( signal ) ;
749739 }
750- if ( ! unowned ) {
751- signal . read = current_consumer_read_clock ;
752- }
753740 }
754741
755742 if ( ( flags & DERIVED ) !== 0 && is_signal_dirty ( signal ) ) {
0 commit comments