From f6d4e5dcd531b9219f24b6b71ae0f099aa66304f Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 13 Nov 2026 01:08:58 +0100 Subject: [PATCH] :bug: Unmask copies without overriding them when a main loses its mask Removing the mask shape of a masked group in a main unmasks the group. The deletion reaches the copies through the same deletion, which ignores touched groups, but the step that unmasks a group that lost its mask did not, so every copy's group came out unmasked and marked as overriding its mask. The unmask follows the deletion's ignore-touched option. Test: removing-the-mask-of-a-main-unmasks-its-copies-without-overriding-them. Benchmark (alone, shared with the next commit): | :world | :baseline | :now | :mean | :ratio | |------------------------------------+-----------+---------+---------+--------| | deepest-edit-through-three-levels | 35.215 | 21.715 | 24.396 | 0.62 | | edit-through-a-chain-of-dependents | 68.931 | 48.192 | 53.222 | 0.7 | | library-update-into-copies | 83.083 | 50.508 | 52.972 | 0.61 | | main-edit-among-many-shapes | 4.837 | 2.345 | 2.775 | 0.48 | | main-edit-into-10-copies | 1.79 | 1.172 | 1.479 | 0.65 | | main-edit-into-100-copies | 15.415 | 11.582 | 13.079 | 0.75 | | main-edit-into-1000-copies | 153.086 | 102.539 | 133.903 | 0.67 | | variant-switch-into-copies | 32.052 | 22.204 | 24.303 | 0.69 | AI-assisted-by: claude-opus-5-5 --- common/src/app/common/logic/shapes.cljc | 4 +++- common/test/common_tests/logic/composable_gen_test.cljc | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/logic/shapes.cljc b/common/src/app/common/logic/shapes.cljc index 413eb9964c..4bf8ff9853 100644 --- a/common/src/app/common/logic/shapes.cljc +++ b/common/src/app/common/logic/shapes.cljc @@ -484,9 +484,11 @@ shape)) {:ignore-touched true :with-objects? true}) (pcb/resize-parents all-parents) + ;; a copy's group unmasked as its main's is no override (pcb/update-shapes groups-to-unmask (fn [shape] - (assoc shape :masked-group false))) + (assoc shape :masked-group false)) + {:ignore-touched (boolean ignore-touched)}) (pcb/update-shapes (map :id interacting-shapes) (fn [shape] (d/update-when shape :interactions diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index f4aad0e201..adf5c584b0 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -2514,6 +2514,11 @@ :ops [[:delete 11] [:detach 5] [:swap 10] [:add-child] [:structure 0 6 3] [:nest 11] [:transform 2 0 0 7] [:detach 13]]})))) +(t/deftest removing-the-mask-of-a-main-unmasks-its-copies-without-overriding-them + (t/is (map? (cg/run {:world [1 0 {:variants true :rich-variants true :text false :layout :grid + :layout-copies false :layout-children false}] + :ops [[:structure 1 1 1] [:remove-child 1]]})))) + (t/deftest settling-a-bool-in-a-grid-copy-twice-keeps-its-shapes-in-place (t/is (map? (cg/run {:world [3 0 {:variants true :rich-variants true :text true :layout :grid :layout-copies true :layout-children true}]