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

View file

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