mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 05:50:35 +00:00
🐛 Clear source overrides after pushing a swapped subtree
When update-main clones a swapped subtree into the main, the new main owns its authored groups. Clear those groups from every source shape when relinking it to the clone, instead of clearing only swap-group. The regression fails on retained source flags before the fix. All five assertions now pass, including retained geometry and opacity values, new-main groups and exact undo. The swap suite passes 43 tests and 173 assertions. Benchmark vs Phase 1e: main 10/100/1000 0.57/0.65/0.73; levels 0.59; chain 0.59; library 0.61; many shapes 0.65; switch 0.68. No flags. AI-assisted-by: GPT-6
This commit is contained in:
parent
f01b260f74
commit
44485aee91
@ -764,7 +764,7 @@
|
||||
update-original-shape (fn [original-shape new-shape]
|
||||
(-> original-shape
|
||||
(assoc :shape-ref (:id new-shape))
|
||||
(ctk/remove-swap-group)))
|
||||
(dissoc :touched)))
|
||||
|
||||
[new-head new-shapes updated-shapes]
|
||||
(ctst/clone-shape child-inst
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
[app.common.test-helpers.compositions :as tho]
|
||||
[app.common.test-helpers.files :as thf]
|
||||
[app.common.test-helpers.ids-map :as thi]
|
||||
[app.common.test-helpers.normalize :as thn]
|
||||
[app.common.test-helpers.shapes :as ths]
|
||||
[app.common.test-helpers.variants :as thv]
|
||||
[app.common.types.component :as ctk]
|
||||
@ -769,3 +770,18 @@
|
||||
(t/is (ctk/touched-group? head :geometry-group))
|
||||
(t/is (mth/close? 45 (:rotation head) 0.001))
|
||||
(t/is (gsh/close-attrs? :points (:points head) (:points (ths/get-shape-by-id full (:id head))) 0.001))))
|
||||
|
||||
(t/deftest update-main-clears-overrides-on-the-swapped-subtree-it-pushes
|
||||
(let [edited (-> (tm/make-situation (setup-sized))
|
||||
(r/step (n/swap-shape :copy-star :heart)) r/settle
|
||||
(r/step (n/change-height :copy-star 80)) r/settle
|
||||
(r/step (n/change-property :copy-star :opacity 0.4)) r/settle)
|
||||
updated (-> edited (r/step (n/update-main :copy)) r/settle)
|
||||
head (tm/resolve-shape updated :copy-star)
|
||||
main (tm/shape-by-id updated (:shape-ref head))]
|
||||
(t/is (empty? (:touched head)))
|
||||
(t/is (= #{:geometry-group :layer-effects-group} (:touched main)))
|
||||
(t/is (= 0.4 (:opacity head) (:opacity main)))
|
||||
(t/is (mth/close? 80 (:height head) 0.001))
|
||||
(t/is (= (thn/normalize-file (tm/file edited))
|
||||
(thn/normalize-file (tm/file (r/step updated (n/undo))))))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user