From 4fba88d56715a8897ca6bc56a0bea2aa79b65c64 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 12 Nov 2026 10:26:29 +0100 Subject: [PATCH] :sparkles: Generate ungroups of shapes a main holds The shape structure property now ungroups groups, bools and boards a main holds, as the ungroup changes keep the copies valid, and the structure node passes the file's pages to them. A grouping that takes every child out of a group, which removes it as well, stays out. Harness only; the benchmark is not run. AI-assisted-by: claude-opus-5-5 --- .../src/app/common/test_helpers/composable/comp/nodes.cljc | 3 ++- common/src/app/common/test_helpers/composable/gen.cljc | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/src/app/common/test_helpers/composable/comp/nodes.cljc b/common/src/app/common/test_helpers/composable/comp/nodes.cljc index 2dfb1a96cd..033c864507 100644 --- a/common/src/app/common/test_helpers/composable/comp/nodes.cljc +++ b/common/src/app/common/test_helpers/composable/comp/nodes.cljc @@ -2294,7 +2294,8 @@ (:id page) shapes "Group" false))) :mask (let [shapes (clg/shapes-for-group-or-mask objects ids)] (second (clg/generate-mask-changes nil (uuid/next) (:id page) objects shapes))) - :ungroup (clg/generate-ungroup-changes nil (:id page) objects (clg/ungroup-ids objects ids)) + :ungroup (clg/generate-ungroup-changes nil (:id page) objects (clg/ungroup-ids objects ids) + (get-in the-file [:data :pages-index])) :unmask (clg/generate-unmask-changes nil (:id page) objects ids) :bool (second (clb/generate-create-bool nil (:id page) objects ids (:bool-type params) nil)) :path (-> (pcb/empty-changes nil (:id page)) diff --git a/common/src/app/common/test_helpers/composable/gen.cljc b/common/src/app/common/test_helpers/composable/gen.cljc index 06f5431227..a0d39c84e8 100644 --- a/common/src/app/common/test_helpers/composable/gen.cljc +++ b/common/src/app/common/test_helpers/composable/gen.cljc @@ -620,14 +620,13 @@ (get shapes (inc index))) pair (cond-> [(:id shape)] (and (odd? (or value 0)) sibling (contains? eligible sibling)) (conj sibling)) - ;; removing a shape a main holds leaves its copies referring to it - ;; until sync, so no edit removes one: no ungroup, and no grouping - ;; that takes every child out of a group + ;; a grouping that takes every child out of a group removes it + ;; and leaves its copies referring to it until sync empties? (and (#{:group :bool} (:type parent)) (= (set pair) (set (:shapes parent)))) targets (case action (:group :mask) (when-not empties? pair) :bool (when (not-any? #(= :text (:type (get objects %))) pair) pair) - :ungroup nil + :ungroup (when (#{:group :bool :frame} (:type shape)) [(:id shape)]) :unmask (when (:masked-group shape) [(:id shape)]) :path (when (#{:rect :circle} (:type shape)) [(:id shape)]))] (when targets