refactor(store): extract workspace out of AppState (#1037)

This commit is contained in:
Himself65 authored and GitHub committed 2023-02-16 11:41:43 +08:00
1 parent a4d0813354
commit cdc2b449a9
30 files changed
+323 -245

No files matched your search

@@ -1,7 +1,6 @@
import { Modal, ModalWrapper } from '@affine/component';
import { IconButton } from '@affine/component';
import { useTranslation } from '@affine/i18n';
import { useAppState } from '@/providers/app-state-provider';
import { useState } from 'react';
import router from 'next/router';
import { toast } from '@affine/component';
@@ -22,7 +21,9 @@ export const EnableWorkspaceModal = ({
const login = useGlobalState(store => store.login);
const user = useGlobalState(store => store.user);
const dataCenter = useGlobalState(store => store.dataCenter);
const { currentWorkspace } = useAppState();
const currentWorkspace = useGlobalState(
useCallback(store => store.currentDataCenterWorkspace, [])
);
const [loading, setLoading] = useState(false);
return (
<Modal open={open} onClose={onClose} data-testid="logout-modal">