From a4ca14038569d48ba3dc68fd188c1ad9ee9f0509 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Tue, 28 Oct 2025 13:24:45 +0100 Subject: [PATCH] wip --- .../app/main/data/workspace/libraries.cljs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index e116393683..5dceb6818f 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -1018,12 +1018,19 @@ (clv/generate-keep-touched changes new-shape shape orig-shapes page libraries ldata) [changes []]) update-layout-ids (concat all-parents parents-of-swapped new-children-ids)] - (rx/of - (dwu/start-undo-transaction undo-id) - (dch/commit-changes changes) - (ptk/data-event :layout/update {:ids update-layout-ids :undo-group undo-group}) - (dwu/commit-undo-transaction undo-id) - (dws/select-shape (:id new-shape) false)))))) + (rx/concat + (rx/of + (dwu/start-undo-transaction undo-id) + (dch/commit-changes changes) + (ptk/data-event :layout/update {:ids update-layout-ids :undo-group undo-group})) + ;; NOTE: we need to schedule a commit into a + ;; microtask for ensure that all the scheduled + ;; microtask of previous events execute before the + ;; commit (specifically the layout/update) + (->> (rx/of (dwu/commit-undo-transaction undo-id) + (dws/select-shape (:id new-shape) false)) + (rx/observe-on :async) + (rx/delay 1000))))))) (defn component-multi-swap "Swaps several components with another one"