fix space manage
This commit is contained in:
parent
197b15eb6d
commit
212f18b69c
2 changed files with 3 additions and 12 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue