This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -668,7 +668,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
668668 * and thus might not cause an update to the store immediately.
669669 * @param {IFilterCondition } filter The filter condition to add.
670670 */
671- public addFilter ( filter : IFilterCondition ) : void {
671+ public async addFilter ( filter : IFilterCondition ) : Promise < void > {
672672 if ( SettingsStore . getValue ( "advancedRoomListLogging" ) ) {
673673 // TODO: Remove debug: https://github.com/vector-im/element-web/issues/14602
674674 console . log ( "Adding filter condition:" , filter ) ;
@@ -680,12 +680,14 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
680680 promise = this . recalculatePrefiltering ( ) ;
681681 } else {
682682 this . filterConditions . push ( filter ) ;
683- if ( this . algorithm ) {
684- this . algorithm . addFilterCondition ( filter ) ;
685- }
686683 // Runtime filters with spaces disable prefiltering for the search all spaces effect
687684 if ( SettingsStore . getValue ( "feature_spaces" ) ) {
688- promise = this . recalculatePrefiltering ( ) ;
685+ // this has to be awaited so that `setKnownRooms` is called in time for the `addFilterCondition` below
686+ // this way the runtime filters are only evaluated on one dataset and not both.
687+ await this . recalculatePrefiltering ( ) ;
688+ }
689+ if ( this . algorithm ) {
690+ this . algorithm . addFilterCondition ( filter ) ;
689691 }
690692 }
691693 promise . then ( ( ) => this . updateFn . trigger ( ) ) ;
Original file line number Diff line number Diff line change @@ -577,9 +577,8 @@ export class Algorithm extends EventEmitter {
577577
578578 await this . generateFreshTags ( newTags ) ;
579579
580- this . cachedRooms = newTags ;
580+ this . cachedRooms = newTags ; // this recalculates the filtered rooms for us
581581 this . updateTagsFromCache ( ) ;
582- this . recalculateFilteredRooms ( ) ;
583582
584583 // Now that we've finished generation, we need to update the sticky room to what
585584 // it was. It's entirely possible that it changed lists though, so if it did then
You can’t perform that action at this time.
0 commit comments