forked from MapComplete/MapComplete
Fix 'stabilized'
This commit is contained in:
parent
36ac99c9ec
commit
a4916a9b6d
3 changed files with 6 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue