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.

feat: update list when deleting a page from all pages (#1086)

zqranb6906467be75
diff --git a/apps/web/src/pages/workspace/[workspaceId]/all.tsx b/apps/web/src/pages/workspace/[workspaceId]/all.tsx
index 3b906fb09f..a632edb44f 100644
--- a/apps/web/src/pages/workspace/[workspaceId]/all.tsx
+++ b/apps/web/src/pages/workspace/[workspaceId]/all.tsx
@@ -4,16 +4,13 @@ import { PageListHeader } from '@/components/header';
import { ReactElement, useCallback } from 'react';
import WorkspaceLayout from '@/components/workspace-layout';
import { useTranslation } from '@affine/i18n';
-import { PageMeta } from '@/providers/app-state-provider';
import Head from 'next/head';
import { useGlobalState } from '@/store/app';
const All = () => {
- const currentWorkspace = useGlobalState(
- useCallback(store => store.currentDataCenterWorkspace, [])
+ const pageList = useGlobalState(
+ useCallback(store => store.dataCenterPageList, [])
);
- const pageList = (currentWorkspace?.blocksuiteWorkspace?.meta.pageMetas ||
- []) as PageMeta[];
const { t } = useTranslation();
return (
<>
diff --git a/apps/web/src/pages/workspace/[workspaceId]/trash.tsx b/apps/web/src/pages/workspace/[workspaceId]/trash.tsx
index 58008d5aa2..64677277e0 100644
--- a/apps/web/src/pages/workspace/[workspaceId]/trash.tsx
+++ b/apps/web/src/pages/workspace/[workspaceId]/trash.tsx
@@ -1,13 +1,16 @@
import { PageListHeader } from '@/components/header';
import { PageList } from '@/components/page-list';
import { TrashIcon } from '@blocksuite/icons';
-import { ReactElement } from 'react';
+import { ReactElement, useCallback } from 'react';
import WorkspaceLayout from '@/components/workspace-layout';
import { useTranslation } from '@affine/i18n';
import Head from 'next/head';
import { useGlobalState } from '@/store/app';
+
export const Trash = () => {
- const pageList = useGlobalState(store => store.dataCenterPageList);
+ const pageList = useGlobalState(
+ useCallback(store => store.dataCenterPageList, [])
+ );
const { t } = useTranslation();
return (
<>