Fix 'stabilized'

This commit is contained in:
Pieter Vander Vennet 2022-06-13 01:35:50 +02:00
parent 36ac99c9ec
commit a4916a9b6d
3 changed files with 6 additions and 6 deletions

View file

@ -227,12 +227,9 @@ export abstract class Store<T> {
const newSource = new UIEventSource<T>(this.data);
let currentCallback = 0;
this.addCallback(latestData => {
currentCallback++;
const thisCallback = currentCallback;
window.setTimeout(() => {
if (thisCallback === currentCallback) {
if (this.data == latestData) { // compare by reference
newSource.setData(latestData);
}
}, millisToStabilize)