@@ -55,9 +55,6 @@ export let current_effect = null;
55
55
/** @type {null | import('./types.js').Signal[] } */
56
56
let current_dependencies = null ;
57
57
let 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 ;
61
58
// Handling capturing of signals from object property getters
62
59
let current_should_capture_signal = false ;
63
60
/** If `true`, `get`ting the signal should not register it as a dependency */
@@ -153,7 +150,6 @@ function create_signal_object(flags, value, block) {
153
150
equals : null ,
154
151
flags,
155
152
init : null ,
156
- read : 0 ,
157
153
references : null ,
158
154
value
159
155
} ;
@@ -190,13 +186,15 @@ function is_signal_dirty(signal) {
190
186
let i ;
191
187
for ( i = 0 ; i < length ; i ++ ) {
192
188
const dependency = dependencies [ i ] ;
189
+ const dep_flags = dependency . flags ;
193
190
194
- if ( ( dependency . flags & MAYBE_DIRTY ) !== 0 && ! is_signal_dirty ( dependency ) ) {
191
+ if ( ( dep_flags & MAYBE_DIRTY ) !== 0 && ! is_signal_dirty ( dependency ) ) {
195
192
set_signal_status ( dependency , CLEAN ) ;
196
193
continue ;
197
194
}
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 ) {
200
198
update_derived ( dependency , true ) ;
201
199
// Might have been mutated from above get.
202
200
if ( ( signal . flags & DIRTY ) !== 0 ) {
@@ -221,7 +219,6 @@ function execute_signal_fn(signal) {
221
219
const init = signal . init ;
222
220
const previous_dependencies = current_dependencies ;
223
221
const previous_dependencies_index = current_dependencies_index ;
224
- const previous_consumer_read_clock = current_consumer_read_clock ;
225
222
const previous_consumer = current_consumer ;
226
223
const previous_block = current_block ;
227
224
const previous_component_context = current_component_context ;
@@ -230,12 +227,6 @@ function execute_signal_fn(signal) {
230
227
const previous_untracking = current_untracking ;
231
228
current_dependencies = /** @type {null | import('./types.js').Signal[] } */ ( null ) ;
232
229
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 ;
239
230
current_consumer = signal ;
240
231
current_block = signal . block ;
241
232
current_component_context = signal . context ;
@@ -290,7 +281,6 @@ function execute_signal_fn(signal) {
290
281
} finally {
291
282
current_dependencies = previous_dependencies ;
292
283
current_dependencies_index = previous_dependencies_index ;
293
- current_consumer_read_clock = previous_consumer_read_clock ;
294
284
current_consumer = previous_consumer ;
295
285
current_block = previous_block ;
296
286
current_component_context = previous_component_context ;
@@ -427,7 +417,7 @@ function flush_queued_effects(effects) {
427
417
for ( i = 0 ; i < length ; i ++ ) {
428
418
const signal = effects [ i ] ;
429
419
const flags = signal . flags ;
430
- if ( ( flags & DESTROYED ) === 0 && ( flags & INERT ) === 0 ) {
420
+ if ( ( flags & ( DESTROYED | INERT ) ) === 0 ) {
431
421
if ( is_signal_dirty ( signal ) ) {
432
422
set_signal_status ( signal , CLEAN ) ;
433
423
execute_effect ( signal ) ;
@@ -744,12 +734,9 @@ export function get(signal) {
744
734
current_dependencies_index ++ ;
745
735
} else if ( current_dependencies === null ) {
746
736
current_dependencies = [ signal ] ;
747
- } else if ( signal . read !== current_consumer_read_clock ) {
737
+ } else if ( signal !== current_dependencies . at ( - 1 ) ) {
748
738
current_dependencies . push ( signal ) ;
749
739
}
750
- if ( ! unowned ) {
751
- signal . read = current_consumer_read_clock ;
752
- }
753
740
}
754
741
755
742
if ( ( flags & DERIVED ) !== 0 && is_signal_dirty ( signal ) ) {
0 commit comments