refactor(core): remove collection atom (#5832)

This commit is contained in:
EYHN
2024-02-27 03:50:56 +00:00
parent ad9b0303c4
commit 5cd488fe1d
41 changed files with 644 additions and 962 deletions

View File

@@ -44,7 +44,7 @@ export function useNavigateHelper() {
);
const jumpToCollections = useCallback(
(workspaceId: string, logic: RouteLogic = RouteLogic.PUSH) => {
return navigate(`/workspace/${workspaceId}/all?filterMode=collections`, {
return navigate(`/workspace/${workspaceId}/collection`, {
replace: logic === RouteLogic.REPLACE,
});
},
@@ -52,7 +52,7 @@ export function useNavigateHelper() {
);
const jumpToTags = useCallback(
(workspaceId: string, logic: RouteLogic = RouteLogic.PUSH) => {
return navigate(`/workspace/${workspaceId}/all?filterMode=tags`, {
return navigate(`/workspace/${workspaceId}/tag`, {
replace: logic === RouteLogic.REPLACE,
});
},

View File

@@ -1,11 +1,10 @@
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { Workspace } from '@toeverything/infra';
import { useService } from '@toeverything/infra/di';
import { useSetAtom, useStore } from 'jotai';
import { useStore } from 'jotai';
import { useTheme } from 'next-themes';
import { useEffect } from 'react';
import { allPageModeSelectAtom } from '../atoms';
import {
registerAffineCreationCommands,
registerAffineHelpCommands,
@@ -27,7 +26,6 @@ export function useRegisterWorkspaceCommands() {
const languageHelper = useLanguageHelper();
const pageHelper = usePageHelper(currentWorkspace.blockSuiteWorkspace);
const navigationHelper = useNavigateHelper();
const setPageListMode = useSetAtom(allPageModeSelectAtom);
const [editor] = useActiveBlocksuiteEditor();
// register AffineUpdatesCommands
@@ -49,19 +47,12 @@ export function useRegisterWorkspaceCommands() {
t,
workspace: currentWorkspace.blockSuiteWorkspace,
navigationHelper,
setPageListMode,
});
return () => {
unsub();
};
}, [
store,
t,
currentWorkspace.blockSuiteWorkspace,
navigationHelper,
setPageListMode,
]);
}, [store, t, currentWorkspace.blockSuiteWorkspace, navigationHelper]);
// register AffineSettingsCommands
useEffect(() => {