feat: filter to only include joined sub-rooms in Home and Space components
This commit is contained in:
@@ -287,9 +287,12 @@ export function Home() {
|
||||
const subRoomsEvent = room.currentState.getStateEvents(StateEvent.PaarrotSubRooms, '');
|
||||
const subRooms = subRoomsEvent?.getContent<{ children: string[] }>()?.children ?? [];
|
||||
|
||||
// Filter to only joined sub-rooms
|
||||
const joinedSubRooms = subRooms.filter(subRoomId => mx.getRoom(subRoomId));
|
||||
|
||||
// Add sub-rooms recursively
|
||||
subRooms.forEach((subRoomId, index) => {
|
||||
addRoomAndSubRooms(subRoomId, depth + 1, roomId, index === subRooms.length - 1);
|
||||
joinedSubRooms.forEach((subRoomId, index) => {
|
||||
addRoomAndSubRooms(subRoomId, depth + 1, roomId, index === joinedSubRooms.length - 1);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -459,11 +459,15 @@ export function Space() {
|
||||
const subRoomsEvent = room.currentState.getStateEvents(StateEvent.PaarrotSubRooms, '');
|
||||
const subRooms = subRoomsEvent?.getContent<{ children: string[] }>()?.children ?? [];
|
||||
|
||||
subRooms.forEach((subRoomId, index) => {
|
||||
if (processedSubRooms.has(subRoomId)) return;
|
||||
// Filter to only joined sub-rooms that haven't been processed
|
||||
const joinedSubRooms = subRooms.filter(subRoomId =>
|
||||
!processedSubRooms.has(subRoomId) && mx.getRoom(subRoomId)
|
||||
);
|
||||
|
||||
joinedSubRooms.forEach((subRoomId, index) => {
|
||||
processedSubRooms.add(subRoomId);
|
||||
|
||||
const isLast = index === subRooms.length - 1;
|
||||
const isLast = index === joinedSubRooms.length - 1;
|
||||
const subRoom = mx.getRoom(subRoomId);
|
||||
if (subRoom) {
|
||||
// Joined sub-room
|
||||
|
||||
Reference in New Issue
Block a user