mirror of
https://github.com/penpot/penpot.git
synced 2026-11-21 01:22:01 +00:00
🐛 Order grid children when adding a shape
Record grid children in cell order before asynchronous reflow. This keeps changes and their undo independent of the reflow schedule. Red child-order regression reproduced. Focused geometry, reset, swap and runner suites pass 121 tests / 540 assertions. Benchmark vs Phase 1e: main 10/100/1000 0.51/0.64/0.65; levels 0.50; chain 0.57; library 0.53; many shapes 0.47; switch 0.59. No flags. AI-assisted-by: GPT-6
This commit is contained in:
parent
cd9700c18c
commit
f6ffb5888b
@ -36,7 +36,8 @@
|
||||
(cond-> (some? cell)
|
||||
(pcb/update-shapes [(:parent-id shape)] #(ctl/push-into-cell % [id] row column)))
|
||||
(cond-> (ctl/grid-layout? objects (:parent-id shape))
|
||||
(pcb/update-shapes [(:parent-id shape)] ctl/assign-cells {:with-objects? true})))]
|
||||
(-> (pcb/update-shapes [(:parent-id shape)] ctl/assign-cells {:with-objects? true})
|
||||
(pcb/reorder-grid-children [(:parent-id shape)]))))]
|
||||
|
||||
[shape changes]))
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
[app.common.test-helpers.files :as thf]
|
||||
[app.common.test-helpers.ids-map :as thi]
|
||||
[app.common.test-helpers.normalize :as thn]
|
||||
[app.common.types.shape.layout :as ctl]
|
||||
[app.common.uuid :as uuid]
|
||||
[clojure.test :as t]))
|
||||
|
||||
@ -583,3 +584,11 @@
|
||||
(t/is false)
|
||||
(reset! counted @made))))
|
||||
(t/is (= 2 @counted))))
|
||||
|
||||
(t/deftest adding-a-grid-child-records-cell-order-before-reflow
|
||||
(let [initial (setup/grid-component-with-copy)
|
||||
changed (-> initial (r/step (n/add-child :grid-root :new-grid-child)) r/settle)
|
||||
grid (tm/resolve-shape changed :grid-root)]
|
||||
(t/is (= (:shapes (ctl/reorder-grid-children grid)) (:shapes grid)))
|
||||
(t/is (= (thn/normalize-file (tm/file initial))
|
||||
(thn/normalize-file (tm/file (r/step changed (n/undo))))))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user