mirror of
https://github.com/penpot/penpot.git
synced 2026-02-14 07:33:04 +00:00
🐛 Fix problem when changing main component with grid elements
This commit is contained in:
@@ -400,9 +400,21 @@
|
||||
:parent-id parent-id
|
||||
:frame-id frame-id)
|
||||
|
||||
:always
|
||||
;; Store in the meta the old id so we can do a remap afterwards
|
||||
;; in the parent
|
||||
(with-meta {::old-id (:id shape)})
|
||||
|
||||
(some? (:shapes shape))
|
||||
(assoc :shapes (mapv :id new-direct-children)))
|
||||
|
||||
;; For a GRID layout remap the cells shapes' old-id to the new id given in the clone
|
||||
new-shape
|
||||
(if (ctl/grid-layout? new-shape)
|
||||
(let [ids-map (into {} (map #(vector (-> % meta ::old-id) (:id %))) new-children)]
|
||||
(ctl/remap-grid-cells new-shape ids-map))
|
||||
new-shape)
|
||||
|
||||
new-shape (update-new-shape new-shape shape)
|
||||
new-shapes (into [new-shape] new-children)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user