From c38dd1cc5e1054f73c9697646e4dce31d6b5b8dd Mon Sep 17 00:00:00 2001 From: 3720 Date: Thu, 13 Jul 2023 23:26:12 +0800 Subject: [PATCH] fix: can't go back to all pages by click `All Pages` button (#3219) --- apps/web/src/components/root-app-sidebar/index.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/root-app-sidebar/index.tsx b/apps/web/src/components/root-app-sidebar/index.tsx index 10eee9af67..0202cc9f90 100644 --- a/apps/web/src/components/root-app-sidebar/index.tsx +++ b/apps/web/src/components/root-app-sidebar/index.tsx @@ -10,6 +10,7 @@ import { SidebarContainer, SidebarScrollableContainer, } from '@affine/component/app-sidebar'; +import { useCollectionManager } from '@affine/component/page-list'; import { isDesktop } from '@affine/env/constant'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { @@ -93,10 +94,10 @@ export const RootAppSidebar = ({ onOpenWorkspaceListModal, onOpenSettingModal, }: RootAppSidebarProps): ReactElement => { - const currentWorkspaceId = currentWorkspace?.id || null; + const currentWorkspaceId = currentWorkspace.id; const [appSettings] = useAppSetting(); - - const blockSuiteWorkspace = currentWorkspace?.blockSuiteWorkspace; + const { backToAll } = useCollectionManager(currentWorkspace.id); + const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace; const t = useAFFiNEI18N(); const onClickNewPage = useCallback(async () => { const page = createPage(); @@ -169,6 +170,7 @@ export const RootAppSidebar = ({ icon={} currentPath={currentPath} path={currentWorkspaceId && paths.all(currentWorkspaceId)} + onClick={backToAll} > {t['All pages']()}