Skip to content

AI-native design editor. Open-source Figma alternative.

fix(undo): call requestRender after undo

Danila Poyarkov44f24fa72eaa
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)