From dd5ec39619f006218c32139c1b5995a407ed3c40 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Thu, 29 Feb 2024 13:32:12 +0100 Subject: [PATCH] :bug: Fix set as thumbnail generate 2 steps for undo --- frontend/src/app/main/data/workspace/shapes.cljs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/data/workspace/shapes.cljs b/frontend/src/app/main/data/workspace/shapes.cljs index e541c0abb..72cbd6f7e 100644 --- a/frontend/src/app/main/data/workspace/shapes.cljs +++ b/frontend/src/app/main/data/workspace/shapes.cljs @@ -436,9 +436,11 @@ ptk/WatchEvent (watch [_ state _] (let [selected (wsh/lookup-selected state) - pages (-> state :workspace-data :pages-index vals)] + pages (-> state :workspace-data :pages-index vals) + undo-id (js/Symbol)] (rx/concat + (rx/of (dwu/start-undo-transaction undo-id)) ;; First: clear the `:use-for-thumbnail` flag from all not ;; selected frames. (rx/from @@ -456,4 +458,5 @@ (dch/update-shapes frame-ids #(dissoc % :use-for-thumbnail) {:page-id page-id}))))) ;; And finally: toggle the flag value on all the selected shapes - (rx/of (dch/update-shapes selected #(update % :use-for-thumbnail not)))))))) + (rx/of (dch/update-shapes selected #(update % :use-for-thumbnail not)) + (dwu/commit-undo-transaction undo-id)))))))