0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

🐛 Fix problem when creating child and update component

This commit is contained in:
alonso.torres 2023-10-30 19:57:44 +01:00 committed by Andrés Moya
parent 4456b08dae
commit e4cadc36b0

View file

@ -370,7 +370,14 @@
(let [new-id (cond
(some? force-id) force-id
keep-ids? (:id object)
:else (uuid/next))]
:else (uuid/next))
;; Assign the correct frame-id for the given parent.
;; It's the parent-id (if frame) or the parent's frame-id otherwise.
frame-id
(if (cph/frame-shape? objects parent-id)
parent-id
(dm/get-in objects [parent-id :frame-id]))]
(loop [child-ids (seq (:shapes object))
new-direct-children []
@ -381,7 +388,8 @@
(let [new-object (cond-> object
:always
(assoc :id new-id
:parent-id parent-id)
:parent-id parent-id
:frame-id frame-id)
(some? (:shapes object))
(assoc :shapes (mapv :id new-direct-children)))