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

This commit is contained in:
Himself65
2023-02-15 21:41:43 -06:00
committed by GitHub
parent a4d0813354
commit cdc2b449a9
30 changed files with 323 additions and 245 deletions

View File

@@ -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">