From 0cce919e48eba268ac754ce980fbbd3d4b61d664 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Sat, 14 Nov 2026 03:22:17 +0100 Subject: [PATCH] :bug: Rename a component and its main in one undo step Renaming a component from the assets panel renames the component, then its main root, in two commits. Undo took them back one at a time, so a single undo left the component and its main with different names. They are now one undo transaction. Found by the frontend replay of generated programs with the new rename kind. The JVM benchmark does not run frontend events; it is not run. AI-assisted-by: claude-opus-5-5 --- frontend/src/app/main/data/workspace/libraries.cljs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index 3ab0446d63..f27c794e62 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -453,13 +453,18 @@ (when (and (some? clean-name) component) (let [shape-id (:main-instance-id component) - page-id (:main-instance-page component)] + page-id (:main-instance-page component) + undo-id (js/Symbol)] + ;; the component and its main root are renamed in one undo step (rx/concat - (rx/of (rename-component component-id clean-name)) + (rx/of (dwu/start-undo-transaction undo-id) + (rename-component component-id clean-name)) (when (and shape-id page-id) - (rx/of (dwsh/update-shapes [shape-id] #(assoc % :name clean-name) {:page-id page-id :stack-undo? true})))))))))) + (rx/of (dwsh/update-shapes [shape-id] #(assoc % :name clean-name) {:page-id page-id :stack-undo? true}))) + + (rx/of (dwu/commit-undo-transaction undo-id))))))))) (defn duplicate-component "Create a new component copied from the one with the given id."