fix: can't go back to all pages by click All Pages button (#3219)
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
|||||||
SidebarContainer,
|
SidebarContainer,
|
||||||
SidebarScrollableContainer,
|
SidebarScrollableContainer,
|
||||||
} from '@affine/component/app-sidebar';
|
} from '@affine/component/app-sidebar';
|
||||||
|
import { useCollectionManager } from '@affine/component/page-list';
|
||||||
import { isDesktop } from '@affine/env/constant';
|
import { isDesktop } from '@affine/env/constant';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import {
|
import {
|
||||||
@@ -93,10 +94,10 @@ export const RootAppSidebar = ({
|
|||||||
onOpenWorkspaceListModal,
|
onOpenWorkspaceListModal,
|
||||||
onOpenSettingModal,
|
onOpenSettingModal,
|
||||||
}: RootAppSidebarProps): ReactElement => {
|
}: RootAppSidebarProps): ReactElement => {
|
||||||
const currentWorkspaceId = currentWorkspace?.id || null;
|
const currentWorkspaceId = currentWorkspace.id;
|
||||||
const [appSettings] = useAppSetting();
|
const [appSettings] = useAppSetting();
|
||||||
|
const { backToAll } = useCollectionManager(currentWorkspace.id);
|
||||||
const blockSuiteWorkspace = currentWorkspace?.blockSuiteWorkspace;
|
const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace;
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
const onClickNewPage = useCallback(async () => {
|
const onClickNewPage = useCallback(async () => {
|
||||||
const page = createPage();
|
const page = createPage();
|
||||||
@@ -169,6 +170,7 @@ export const RootAppSidebar = ({
|
|||||||
icon={<FolderIcon />}
|
icon={<FolderIcon />}
|
||||||
currentPath={currentPath}
|
currentPath={currentPath}
|
||||||
path={currentWorkspaceId && paths.all(currentWorkspaceId)}
|
path={currentWorkspaceId && paths.all(currentWorkspaceId)}
|
||||||
|
onClick={backToAll}
|
||||||
>
|
>
|
||||||
<span data-testid="all-pages">{t['All pages']()}</span>
|
<span data-testid="all-pages">{t['All pages']()}</span>
|
||||||
</RouteMenuLinkItem>
|
</RouteMenuLinkItem>
|
||||||
|
|||||||
Reference in New Issue
Block a user