File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -275,12 +275,6 @@ export function producerIncrementEpoch(): void {
275
275
* Ensure this producer's `version` is up-to-date.
276
276
*/
277
277
export function producerUpdateValueVersion ( node : ReactiveNode ) : void {
278
- if ( consumerIsLive ( node ) && ! node . dirty ) {
279
- // A live consumer will be marked dirty by producers, so a clean state means that its version
280
- // is guaranteed to be up-to-date.
281
- return ;
282
- }
283
-
284
278
if ( ! node . dirty && node . lastCleanEpoch === epoch ) {
285
279
// Even non-live consumers can skip polling if they previously found themselves to be clean at
286
280
// the current epoch, since their dependencies could not possibly have changed (such a change
Original file line number Diff line number Diff line change @@ -178,4 +178,16 @@ describe('Watcher', () => {
178
178
signal . set ( 1 ) ;
179
179
expect ( mockGetPending ) . toBeCalled ( ) ;
180
180
} ) ;
181
+
182
+ it ( 'should not break a computed signal to watch it before getting its value' , ( ) => {
183
+ const signal = new Signal . State ( 0 ) ;
184
+ const computedSignal = new Signal . Computed ( ( ) => signal . get ( ) ) ;
185
+ const watcher = new Signal . subtle . Watcher ( ( ) => { } ) ;
186
+ expect ( computedSignal . get ( ) ) . toBe ( 0 ) ;
187
+ signal . set ( 1 ) ;
188
+ watcher . watch ( computedSignal ) ;
189
+ expect ( computedSignal . get ( ) ) . toBe ( 1 ) ;
190
+ watcher . unwatch ( computedSignal ) ;
191
+ expect ( computedSignal . get ( ) ) . toBe ( 1 ) ;
192
+ } ) ;
181
193
} ) ;
You can’t perform that action at this time.
0 commit comments