diff --git a/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx b/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx index 70a89d755c47..3092de289377 100644 --- a/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx +++ b/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx @@ -137,7 +137,7 @@ const HistoryEditorPreview = ({ {snapshotPage ? ( - + - {historyList.map((item, i) => { + {historyList.map((_item, i) => { const historyIndex = historyList.findIndex(h => h.timestamp === ts); const distance = i - historyIndex; const flag = @@ -175,11 +175,7 @@ const HistoryEditorPreview = ({ ? '< -20' : distance.toString(); return ( -
+
{historyIndex === i ? content : null}
); diff --git a/tests/affine-cloud/e2e/page-history.spec.ts b/tests/affine-cloud/e2e/page-history.spec.ts index 71d0ec31e60d..7879a33f22fd 100644 --- a/tests/affine-cloud/e2e/page-history.spec.ts +++ b/tests/affine-cloud/e2e/page-history.spec.ts @@ -98,6 +98,9 @@ test('can restore page to a history version', async ({ page }) => { await pushCurrentPageUpdates(page); const title = getBlockSuiteEditorTitle(page); + + await title.focus(); + await title.pressSequentially('TEST TITLE', { delay: 50, }); @@ -105,7 +108,13 @@ test('can restore page to a history version', async ({ page }) => { // write something and push to history await pushCurrentPageUpdates(page); - await title.fill('New Title'); + await title.selectText(); + + await title.press('Backspace'); + + await title.pressSequentially('New Title', { + delay: 50, + }); // click the history button await page.getByTestId('header-dropDownButton').click();