fix space manage

This commit is contained in:
hippoz 2023-03-26 01:06:03 +02:00
parent 197b15eb6d
commit 212f18b69c
Signed by: hippoz
GPG key ID: 56C4E02A85F2FBED
2 changed files with 3 additions and 12 deletions

View file

@ -290,19 +290,11 @@ function SpaceManageContent({ roomId, requestClose }) {
const [spacePath, addPathItem] = useSpacePath(roomId);
const [isLoading, setIsLoading] = useState(true);
const [selected, setSelected] = useState([]);
const mountStore = useStore();
const currentPath = spacePath[spacePath.length - 1];
useChildUpdate(currentPath.roomId, roomsHierarchy);
const currentHierarchy = roomsHierarchy.getHierarchy(currentPath.roomId);
useEffect(() => {
mountStore.setItem(true);
return () => {
mountStore.setItem(false);
};
}, [roomId]);
useEffect(() => setSelected([]), [spacePath]);
const handleSelected = (selectedRoomId) => {
@ -324,11 +316,9 @@ function SpaceManageContent({ roomId, requestClose }) {
setIsLoading(true);
try {
await roomsHierarchy.load(currentPath.roomId);
if (!mountStore.getItem()) return;
setIsLoading(false);
forceUpdate();
} catch {
if (!mountStore.getItem()) return;
} catch(O_o) {
setIsLoading(false);
forceUpdate();
}

View file

@ -40,7 +40,8 @@ class RoomsHierarchy {
try {
await roomHierarchy.load(limit);
return roomHierarchy.rooms;
} catch {
} catch (o_O) {
console.error(o_O);
return roomHierarchy.rooms;
}
}