mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-16 13:57:02 +08:00
fix: jump to index page after deletion (#3169)
(cherry picked from commit 37c8465af8)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { usePassiveWorkspaceEffect } from '@toeverything/hooks/use-block-suite-workspace';
|
import { usePassiveWorkspaceEffect } from '@toeverything/hooks/use-block-suite-workspace';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
|
import { useRouter } from 'next/router';
|
||||||
import { Suspense, useCallback } from 'react';
|
import { Suspense, useCallback } from 'react';
|
||||||
|
|
||||||
import { getUIAdapter } from '../../../../adapters/workspace';
|
import { getUIAdapter } from '../../../../adapters/workspace';
|
||||||
@@ -13,6 +14,7 @@ export const WorkspaceSetting = ({ workspaceId }: { workspaceId: string }) => {
|
|||||||
usePassiveWorkspaceEffect(workspace.blockSuiteWorkspace);
|
usePassiveWorkspaceEffect(workspace.blockSuiteWorkspace);
|
||||||
const setSettingModal = useSetAtom(openSettingModalAtom);
|
const setSettingModal = useSetAtom(openSettingModalAtom);
|
||||||
const helper = useAppHelper();
|
const helper = useAppHelper();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const { NewSettingsDetail } = getUIAdapter(workspace.flavour);
|
const { NewSettingsDetail } = getUIAdapter(workspace.flavour);
|
||||||
|
|
||||||
@@ -20,8 +22,9 @@ export const WorkspaceSetting = ({ workspaceId }: { workspaceId: string }) => {
|
|||||||
async (id: string) => {
|
async (id: string) => {
|
||||||
await helper.deleteWorkspace(id);
|
await helper.deleteWorkspace(id);
|
||||||
setSettingModal(prev => ({ ...prev, open: false, workspaceId: null }));
|
setSettingModal(prev => ({ ...prev, open: false, workspaceId: null }));
|
||||||
|
router.push('/').catch(console.error);
|
||||||
},
|
},
|
||||||
[setSettingModal, helper]
|
[helper, setSettingModal, router]
|
||||||
);
|
);
|
||||||
const onTransformWorkspace = useOnTransformWorkspace();
|
const onTransformWorkspace = useOnTransformWorkspace();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user