Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: jump to index page after deletion (#3169)

Alex Yang37c8465af85a
diff --git a/apps/web/src/components/affine/setting-modal/workspace-setting/index.tsx b/apps/web/src/components/affine/setting-modal/workspace-setting/index.tsx
index 2131466efc..b34def74d9 100644
--- a/apps/web/src/components/affine/setting-modal/workspace-setting/index.tsx
+++ b/apps/web/src/components/affine/setting-modal/workspace-setting/index.tsx
@@ -1,5 +1,6 @@
import { usePassiveWorkspaceEffect } from '@toeverything/hooks/use-block-suite-workspace';
import { useSetAtom } from 'jotai';
+import { useRouter } from 'next/router';
import { Suspense, useCallback } from 'react';
import { getUIAdapter } from '../../../../adapters/workspace';
@@ -13,6 +14,7 @@ export const WorkspaceSetting = ({ workspaceId }: { workspaceId: string }) => {
usePassiveWorkspaceEffect(workspace.blockSuiteWorkspace);
const setSettingModal = useSetAtom(openSettingModalAtom);
const helper = useAppHelper();
+ const router = useRouter();
const { NewSettingsDetail } = getUIAdapter(workspace.flavour);
@@ -20,8 +22,9 @@ export const WorkspaceSetting = ({ workspaceId }: { workspaceId: string }) => {
async (id: string) => {
await helper.deleteWorkspace(id);
setSettingModal(prev => ({ ...prev, open: false, workspaceId: null }));
+ router.push('/').catch(console.error);
},
- [setSettingModal, helper]
+ [helper, setSettingModal, router]
);
const onTransformWorkspace = useOnTransformWorkspace();