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:
Florian Duros
2026-06-04 14:40:56 +00:00
committed by GitHub
parent 6a6e603450
commit f65a53a174
2 changed files with 48 additions and 7 deletions
@@ -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);
}
/**