@@ -659,12 +659,17 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
659659 if ( trigger ) this . updateFn . trigger ( ) ;
660660 }
661661
662+ /**
663+ * Adds a filter condition to the room list store. Filters may be applied async,
664+ * and thus might not cause an update to the store immediately.
665+ * @param {IFilterCondition } filter The filter condition to add.
666+ */
662667 public addFilter ( filter : IFilterCondition ) : void {
663668 if ( SettingsStore . getValue ( "advancedRoomListLogging" ) ) {
664669 // TODO: Remove debug: https://github.com/vector-im/element-web/issues/14602
665670 console . log ( "Adding filter condition:" , filter ) ;
666671 }
667- let promise = Promise . resolve ( ) ; // use a promise to maintain sync API contract
672+ let promise = Promise . resolve ( ) ;
668673 if ( filter . kind === FilterKind . Prefilter ) {
669674 filter . on ( FILTER_CHANGED , this . onPrefilterUpdated ) ;
670675 this . prefilterConditions . push ( filter ) ;
@@ -678,12 +683,19 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
678683 promise . then ( ( ) => this . updateFn . trigger ( ) ) ;
679684 }
680685
686+ /**
687+ * Removes a filter condition from the room list store. If the filter was
688+ * not previously added to the room list store, this will no-op. The effects
689+ * of removing a filter may be applied async and therefore might not cause
690+ * an update right away.
691+ * @param {IFilterCondition } filter The filter condition to remove.
692+ */
681693 public removeFilter ( filter : IFilterCondition ) : void {
682694 if ( SettingsStore . getValue ( "advancedRoomListLogging" ) ) {
683695 // TODO: Remove debug: https://github.com/vector-im/element-web/issues/14602
684696 console . log ( "Removing filter condition:" , filter ) ;
685697 }
686- let promise = Promise . resolve ( ) ; // use a promise to maintain sync API contract
698+ let promise = Promise . resolve ( ) ;
687699 let idx = this . filterConditions . indexOf ( filter ) ;
688700 if ( idx >= 0 ) {
689701 this . filterConditions . splice ( idx , 1 ) ;
0 commit comments