You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a computed is watched by a watcher, then a dependency is updated, then the computed is re-watched by the watcher, the computed will not update.
constcount=newSignal.State(0);constcountPlusOne=newSignal.Computed(()=>{returncount.get()+1;});constwatcher=newSignal.subtle.Watcher(()=>{watcher.watch();});watcher.watch(countPlusOne);console.log('expected 1, got',countPlusOne.get());count.set(1);console.log('expected 2, got',countPlusOne.get());watcher.unwatch(countPlusOne);count.set(2);// If this line is removed, the computed works.watcher.watch(countPlusOne);// Reading countPlusOne here gives an incorrect value of 2!console.log('expected 3, got',countPlusOne.get());
The text was updated successfully, but these errors were encountered:
Reproduction: https://stackblitz.com/edit/signal-polyfil-unwatch-bug?file=src%2Fmain.ts
If a computed is watched by a watcher, then a dependency is updated, then the computed is re-watched by the watcher, the computed will not update.
The text was updated successfully, but these errors were encountered: