From 44f24fa72eaa9b458aa8b7aa442003b80cff4efa Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Thu, 23 Apr 2026 20:03:11 +0300 Subject: [PATCH] fix(undo): call requestRender after undo undoAction was missing requestRender, unlike redoAction. Added E2E test: 3 duplicates then 3 undos verifies all are reversed. --- packages/core/src/editor/undo.ts | 1 + tests/e2e/copy-paste.spec.ts | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/packages/core/src/editor/undo.ts b/packages/core/src/editor/undo.ts index b69acce67..44a9bfddc 100644 --- a/packages/core/src/editor/undo.ts +++ b/packages/core/src/editor/undo.ts @@ -110,6 +110,7 @@ export function createUndoActions(ctx: EditorContext) { function undoAction(validateEnteredContainer: () => void) { ctx.undo.undo() validateEnteredContainer() + ctx.requestRender() } function redoAction(validateEnteredContainer: () => void) { diff --git a/tests/e2e/copy-paste.spec.ts b/tests/e2e/copy-paste.spec.ts index bb20db197..b71b04e5f 100644 --- a/tests/e2e/copy-paste.spec.ts +++ b/tests/e2e/copy-paste.spec.ts @@ -116,6 +116,30 @@ test('cut removes original', async () => { expect(await getPageChildCount()).toBe(0) }) +test('multiple pastes can all be undone', async () => { + await canvas.clearCanvas() + await canvas.drawRect(100, 100, 80, 60) + await canvas.waitForRender() + + expect(await getPageChildCount()).toBe(1) + + // Duplicate 3 times via Cmd+D (synchronous, no clipboard issues) + for (let i = 0; i < 3; i++) { + await canvas.duplicate() + await canvas.waitForRender() + } + + expect(await getPageChildCount()).toBe(4) // 1 original + 3 duplicates + + // Undo all 3 duplicates + for (let i = 0; i < 3; i++) { + await canvas.undo() + await canvas.waitForRender() + } + + expect(await getPageChildCount()).toBe(1) // back to original only +}) + test('multi-select duplicate creates copies of all', async () => { await canvas.clearCanvas() await canvas.drawRect(100, 100, 60, 60)