fix(undo): call requestRender after undo

undoAction was missing requestRender, unlike redoAction. Added
E2E test: 3 duplicates then 3 undos verifies all are reversed.
This commit is contained in:
Danila Poyarkov 2026-04-23 20:03:11 +03:00
parent 668309a557
commit 44f24fa72e
2 changed files with 25 additions and 0 deletions

View file

@ -110,6 +110,7 @@ export function createUndoActions(ctx: EditorContext) {
function undoAction(validateEnteredContainer: () => void) {
ctx.undo.undo()
validateEnteredContainer()
ctx.requestRender()
}
function redoAction(validateEnteredContainer: () => void) {

View file

@ -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)