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: can't go back to all pages by click `All Pages` button (#3219)

372023ac82f8454b
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={<FolderIcon />}
currentPath={currentPath}
path={currentWorkspaceId && paths.all(currentWorkspaceId)}
+ onClick={backToAll}
>
<span data-testid="all-pages">{t['All pages']()}</span>
</RouteMenuLinkItem>