mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix: activities make chrome crash;
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user