fix: delete workspace in settings (#3030)

(cherry picked from commit dec0c0d3d1)
This commit is contained in:
Peng Xiao
2023-07-05 18:31:11 +08:00
committed by Alex Yang
parent e41abe4cfe
commit 0a607e0450
4 changed files with 13 additions and 12 deletions
@@ -1,5 +1,4 @@
import { assertExists } from '@blocksuite/global/utils';
import React, { Suspense, useCallback } from 'react';
import { Suspense, useCallback } from 'react';
import { getUIAdapter } from '../../../../adapters/workspace';
import { useOnTransformWorkspace } from '../../../../hooks/root/use-on-transform-workspace';
@@ -10,11 +9,12 @@ export const WorkSpaceSetting = ({ workspace }: { workspace: Workspace }) => {
const helper = useAppHelper();
const { NewSettingsDetail } = getUIAdapter(workspace.flavour);
const onDeleteWorkspace = useCallback(async () => {
assertExists(currentWorkspace);
const workspaceId = currentWorkspace.id;
return helper.deleteWorkspace(workspaceId);
}, [helper]);
const onDeleteWorkspace = useCallback(
async (id: string) => {
return helper.deleteWorkspace(id);
},
[helper]
);
const onTransformWorkspace = useOnTransformWorkspace();
return (