From 8175ab2fec6ff394de16eaad6325ef06a1c2b613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Fri, 21 Nov 2025 09:32:22 +0100 Subject: [PATCH] fix: trigger React re-renders after DrawCommand undo/redo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DrawCommand was correctly restoring canvas state but wasn't triggering React re-renders, causing the UI to appear unchanged. Added updateLayer() calls with timestamp updates to both execute() and undo() methods to ensure proper re-rendering after canvas modifications. Fixes fill tool undo functionality and ensures all drawing operations properly update the UI when undone/redone. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- core/commands/draw-command.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/commands/draw-command.ts b/core/commands/draw-command.ts index 86e5bdf..9aa60db 100644 --- a/core/commands/draw-command.ts +++ b/core/commands/draw-command.ts @@ -43,6 +43,10 @@ export class DrawCommand extends BaseCommand { ctx.clearRect(0, 0, layer.canvas.width, layer.canvas.height); ctx.drawImage(this.afterCanvas, 0, 0); + + // Trigger re-render by updating layer timestamp + const { updateLayer } = useLayerStore.getState(); + updateLayer(this.layerId, { updatedAt: Date.now() }); } undo(): void { @@ -56,5 +60,9 @@ export class DrawCommand extends BaseCommand { ctx.clearRect(0, 0, layer.canvas.width, layer.canvas.height); ctx.drawImage(this.beforeCanvas, 0, 0); + + // Trigger re-render by updating layer timestamp + const { updateLayer } = useLayerStore.getState(); + updateLayer(this.layerId, { updatedAt: Date.now() }); } }