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: trash restore (#1446)

VictorNanka110cec7bf635
diff --git a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx
index 80d86458b4..ca12e4b710 100644
--- a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx
+++ b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx
@@ -118,7 +118,6 @@ export const TrashOperationCell: React.FC<TrashOperationCellProps> = ({
pageMeta,
onPermanentlyDeletePage,
onRestorePage,
- onOpenPage,
}) => {
const { id, title } = pageMeta;
const { t } = useTranslation();
@@ -132,7 +131,6 @@ export const TrashOperationCell: React.FC<TrashOperationCellProps> = ({
onClick={() => {
onRestorePage(id);
toast(t('restored', { title: title || 'Untitled' }));
- onOpenPage(id);
}}
>
<ResetIcon />
diff --git a/tests/local-first-restore-page.spec.ts b/tests/local-first-restore-page.spec.ts
index a8b2868e89..a8af8570fa 100644
--- a/tests/local-first-restore-page.spec.ts
+++ b/tests/local-first-restore-page.spec.ts
@@ -12,7 +12,6 @@ test.describe('Local first delete page', () => {
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');
- const originPageUrl = page.url();
const newPageId = page.url().split('/').reverse()[0];
await page.getByRole('link', { name: 'All pages' }).click();
const cell = page.getByRole('cell', {
@@ -33,6 +32,7 @@ test.describe('Local first delete page', () => {
await page.getByRole('button', { name: 'Delete' }).click();
await page.getByRole('link', { name: 'Trash' }).click();
+ const trashPage = await page.url();
// restore it
await page
.getByTestId('more-actions-' + newPageId)
@@ -40,9 +40,8 @@ test.describe('Local first delete page', () => {
.first()
.click();
- // go to page detail
- expect(page.url()).toBe(originPageUrl);
-
+ // stay in trash page
+ expect(page.url()).toBe(trashPage);
await page.getByRole('link', { name: 'All pages' }).click();
const restoreCell = page.getByRole('cell', {
name: 'this is a new page to restore',