mirror of https://github.com/vector-im/riot-web
Properly recurse subspaces for leave space dialog options (#7775)
parent
fd832488f1
commit
7668984ee4
|
@ -41,7 +41,14 @@ const isOnlyAdmin = (room: Room): boolean => {
|
|||
};
|
||||
|
||||
const LeaveSpaceDialog: React.FC<IProps> = ({ space, onFinished }) => {
|
||||
const spaceChildren = useMemo(() => SpaceStore.instance.getChildren(space.roomId), [space.roomId]);
|
||||
const spaceChildren = useMemo(() => {
|
||||
const roomSet = new Set(SpaceStore.instance.getSpaceFilteredRoomIds(space.roomId));
|
||||
SpaceStore.instance.traverseSpace(space.roomId, spaceId => {
|
||||
if (space.roomId === spaceId) return; // skip the root node
|
||||
roomSet.add(spaceId);
|
||||
}, false);
|
||||
return Array.from(roomSet).map(roomId => space.client.getRoom(roomId)).filter(Boolean);
|
||||
}, [space]);
|
||||
const [roomsToLeave, setRoomsToLeave] = useState<Room[]>([]);
|
||||
const selectedRooms = useMemo(() => new Set(roomsToLeave), [roomsToLeave]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue