Merge pull request #5976 from matrix-org/t3chguy/fix/17153
Improve performance of search all spaces and space switchingpull/21833/head
commit
202dfd4521
|
@ -668,7 +668,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
|
||||||
* and thus might not cause an update to the store immediately.
|
* and thus might not cause an update to the store immediately.
|
||||||
* @param {IFilterCondition} filter The filter condition to add.
|
* @param {IFilterCondition} filter The filter condition to add.
|
||||||
*/
|
*/
|
||||||
public addFilter(filter: IFilterCondition): void {
|
public async addFilter(filter: IFilterCondition): Promise<void> {
|
||||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||||
// TODO: Remove debug: https://github.com/vector-im/element-web/issues/14602
|
// TODO: Remove debug: https://github.com/vector-im/element-web/issues/14602
|
||||||
console.log("Adding filter condition:", filter);
|
console.log("Adding filter condition:", filter);
|
||||||
|
@ -680,12 +680,14 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
|
||||||
promise = this.recalculatePrefiltering();
|
promise = this.recalculatePrefiltering();
|
||||||
} else {
|
} else {
|
||||||
this.filterConditions.push(filter);
|
this.filterConditions.push(filter);
|
||||||
if (this.algorithm) {
|
|
||||||
this.algorithm.addFilterCondition(filter);
|
|
||||||
}
|
|
||||||
// Runtime filters with spaces disable prefiltering for the search all spaces effect
|
// Runtime filters with spaces disable prefiltering for the search all spaces effect
|
||||||
if (SettingsStore.getValue("feature_spaces")) {
|
if (SettingsStore.getValue("feature_spaces")) {
|
||||||
promise = this.recalculatePrefiltering();
|
// this has to be awaited so that `setKnownRooms` is called in time for the `addFilterCondition` below
|
||||||
|
// this way the runtime filters are only evaluated on one dataset and not both.
|
||||||
|
await this.recalculatePrefiltering();
|
||||||
|
}
|
||||||
|
if (this.algorithm) {
|
||||||
|
this.algorithm.addFilterCondition(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
promise.then(() => this.updateFn.trigger());
|
promise.then(() => this.updateFn.trigger());
|
||||||
|
|
|
@ -577,9 +577,8 @@ export class Algorithm extends EventEmitter {
|
||||||
|
|
||||||
await this.generateFreshTags(newTags);
|
await this.generateFreshTags(newTags);
|
||||||
|
|
||||||
this.cachedRooms = newTags;
|
this.cachedRooms = newTags; // this recalculates the filtered rooms for us
|
||||||
this.updateTagsFromCache();
|
this.updateTagsFromCache();
|
||||||
this.recalculateFilteredRooms();
|
|
||||||
|
|
||||||
// Now that we've finished generation, we need to update the sticky room to what
|
// Now that we've finished generation, we need to update the sticky room to what
|
||||||
// it was. It's entirely possible that it changed lists though, so if it did then
|
// it was. It's entirely possible that it changed lists though, so if it did then
|
||||||
|
|
Loading…
Reference in New Issue