Room list: improve custom sections in Spaces (#33523)

* feat: display empty custom sections in the space where they were created

* test: update tests

* fix: room can't be drag in to a section if a section is created before

* fix: re-render issue when section is created
This commit is contained in:
Florian Duros
2026-05-27 09:43:59 +00:00
committed by GitHub
parent 1f305f1e10
commit abe383d996
7 changed files with 174 additions and 19 deletions
@@ -645,6 +645,10 @@ export class RoomListViewModel
};
public onSectionCreated = (tag: string): void => {
// Refresh roomsResult so the new section lands in the same snapshot as the scroll-to.
const filterKeys = this.activeFilter !== undefined ? [this.activeFilter] : undefined;
this.roomsResult = RoomListStoreV3.instance.getSortedRoomsInActiveSpace(filterKeys);
this.updateRoomsMap(this.roomsResult);
this.updateRoomListData(false, null, tag);
this.showToast("section_created");
};
@@ -694,9 +698,11 @@ function computeSections(
const customSections = getCustomSectionData();
const sections = roomsResult.sections
// Only include sections that have rooms or are custom sections (which may be empty but should still be shown)
// Only include sections that have rooms, or custom sections that were created in the current space.
.filter(
(section) => section.rooms.length > 0 || (isCustomSectionTag(section.tag) && customSections[section.tag]),
(section) =>
section.rooms.length > 0 ||
(isCustomSectionTag(section.tag) && customSections[section.tag]?.spaceId === roomsResult.spaceId),
)
// Remove roomIds for sections that are currently collapsed according to their section header view model
.map((section) => ({