Room list: hide empty section when a filter is enabled (#33747)
* fix: hide empty section when a filter is enabled * test: add unit tests
This commit is contained in:
@@ -459,14 +459,16 @@ export class RoomListStoreV3Class extends AsyncStoreWithClient<EmptyObject> {
|
||||
* @returns An array of sections
|
||||
*/
|
||||
private getSections(filterKeys?: FilterKey[]): Section[] {
|
||||
return this.sortedTags.map((tag) => {
|
||||
const filters = filterBoolean([this.filterByTag.get(tag)?.key, ...(filterKeys || [])]);
|
||||
return this.sortedTags
|
||||
.map((tag) => {
|
||||
const filters = filterBoolean([this.filterByTag.get(tag)?.key, ...(filterKeys ?? [])]);
|
||||
|
||||
return {
|
||||
tag,
|
||||
rooms: Array.from(this.roomSkipList?.getRoomsInActiveSpace(filters) || []),
|
||||
};
|
||||
});
|
||||
return {
|
||||
tag,
|
||||
rooms: Array.from(this.roomSkipList?.getRoomsInActiveSpace(filters) || []),
|
||||
};
|
||||
})
|
||||
.filter((section) => !filterKeys || section.rooms.length > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user