fix: activities make chrome crash;

This commit is contained in:
mitsuhatu
2022-07-28 15:36:44 +08:00
parent ca7abcbdbe
commit 986b9f45a4

View File

@@ -45,23 +45,27 @@ const StyledWrapper = styled('div')({
});
export const Activities = () => {
const navigate = useNavigate();
const { user, currentSpaceId } = useUserAndSpaces();
const [recenPages, setRecentPages] = useState([]);
const [recentPages, setRecentPages] = useState([]);
const userId = user?.id;
const fetchRecentPages = useCallback(async () => {
if (!user || !currentSpaceId) {
if (!userId || !currentSpaceId) {
return;
}
const recent_pages = await services.api.userConfig.getRecentPages(
currentSpaceId,
user.id
userId
);
setRecentPages(recent_pages);
}, [user, currentSpaceId]);
}, [userId, currentSpaceId]);
useEffect(() => {
fetchRecentPages();
}, [user, currentSpaceId]);
(async () => {
await fetchRecentPages();
})();
}, [fetchRecentPages]);
useEffect(() => {
let unobserve: () => void;
@@ -80,12 +84,10 @@ export const Activities = () => {
};
}, [currentSpaceId, fetchRecentPages]);
const navigate = useNavigate();
return (
<StyledWrapper>
<List>
{recenPages.map(({ id, title, lastOpenTime }) => {
{recentPages.map(({ id, title, lastOpenTime }) => {
return (
<ListItem className="item" key={id}>
<ListItemButton