mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 14:05:04 +08:00
RoomListStore removeFilter skip triggering update if nothing changed
This commit is contained in:
parent
12461a79e1
commit
8c073a6439
@ -711,6 +711,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
|
||||
}
|
||||
let promise = Promise.resolve();
|
||||
let idx = this.filterConditions.indexOf(filter);
|
||||
let removed = false;
|
||||
if (idx >= 0) {
|
||||
this.filterConditions.splice(idx, 1);
|
||||
|
||||
@ -721,14 +722,20 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
|
||||
if (SpaceStore.spacesEnabled) {
|
||||
promise = this.recalculatePrefiltering();
|
||||
}
|
||||
removed = true;
|
||||
}
|
||||
|
||||
idx = this.prefilterConditions.indexOf(filter);
|
||||
if (idx >= 0) {
|
||||
filter.off(FILTER_CHANGED, this.onPrefilterUpdated);
|
||||
this.prefilterConditions.splice(idx, 1);
|
||||
promise = this.recalculatePrefiltering();
|
||||
removed = true;
|
||||
}
|
||||
|
||||
if (removed) {
|
||||
promise.then(() => this.updateFn.trigger());
|
||||
}
|
||||
promise.then(() => this.updateFn.trigger());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user