diff --git a/common/src/app/common/logic/swap.cljc b/common/src/app/common/logic/swap.cljc index b143828985..e8f803a5bf 100644 --- a/common/src/app/common/logic/swap.cljc +++ b/common/src/app/common/logic/swap.cljc @@ -427,11 +427,21 @@ (get (pcb/get-objects changes) (:id new-shape)) changes - (generate-keep-orientation changes new-shape shape)] + (generate-keep-orientation changes new-shape shape) + + ;; the touched groups of the restored properties, so they stay overrides + kept-touched-groups + (into #{} + (comp (keep #(ctk/resolve-sync-group (:type new-shape) %)) + (filter #(ctk/touched-group? shape %))) + (keys keep-props-values))] [new-shape (-> changes ;; Restore the properties - (pcb/update-shapes [(:id new-shape)] #(d/patch-object % keep-props-values) + (pcb/update-shapes [(:id new-shape)] + #(cond-> (d/patch-object % keep-props-values) + (seq kept-touched-groups) + (update :touched (fnil into #{}) kept-touched-groups)) {:ignore-touched true}) ;; We need to set the same index as the original shape diff --git a/common/test/common_tests/logic/variants_switch_test.cljc b/common/test/common_tests/logic/variants_switch_test.cljc index 12fb3a0dd5..15da52f3ee 100644 --- a/common/test/common_tests/logic/variants_switch_test.cljc +++ b/common/test/common_tests/logic/variants_switch_test.cljc @@ -1938,7 +1938,8 @@ (doseq [group layout-item-override-groups] (t/is (contains? (:touched shape) group) (str label ": touched group " group))) - (t/is (= (count layout-item-override-groups) (count (:touched shape))) + ;; making a copy child absolute also authors its geometry, a group of its own + (t/is (= (count layout-item-override-groups) (count (disj (:touched shape) :geometry-group))) (str label ": number of touched groups"))) (def ^:private layout-item-attrs-partial @@ -1974,7 +1975,8 @@ (doseq [group layout-item-partial-override-groups] (t/is (contains? (:touched shape) group) (str label ": touched group " group))) - (t/is (= (count layout-item-partial-override-groups) (count (:touched shape))) + ;; making a copy child absolute also authors its geometry, a group of its own + (t/is (= (count layout-item-partial-override-groups) (count (disj (:touched shape) :geometry-group))) (str label ": number of touched groups"))) (t/deftest test-switch-preserves-touched-layout-item-attrs-on-root