fix:delete bugs

This commit is contained in:
DiamondThree 2023-01-05 19:07:14 +08:00
parent 855ad54fe1
commit 2773b3e489

View File

@ -8,13 +8,16 @@ export const WorkspaceSelector = () => {
const [workspaceListShow, setWorkspaceListShow] = useState(false);
const [workspace, setWorkSpace] = useState(getActiveWorkspace());
useEffect(() => {
getWorkspace();
setWorkspace();
}, [workspaceListShow]);
const workspaceList = getWorkspaces();
if (workspaceList.length === 0) {
setWorkspaceListShow(true);
}
const getWorkspace = () => {
useEffect(() => {
const workspaceList = getWorkspaces();
if (workspaceList.length === 0) {
setWorkspaceListShow(true);
}
});
const setWorkspace = () => {
const workspace = getActiveWorkspace();
setWorkSpace(workspace);
};
@ -42,7 +45,7 @@ export const WorkspaceSelector = () => {
open={workspaceListShow}
onClose={() => {
setWorkspaceListShow(false);
getWorkspace();
setWorkspace();
}}
></WorkspaceModal>
</>