mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 21:09:00 -05:00
🐛 Fix problem when creating child and update component
This commit is contained in:
parent
4456b08dae
commit
e4cadc36b0
1 changed files with 10 additions and 2 deletions
|
@ -370,7 +370,14 @@
|
||||||
(let [new-id (cond
|
(let [new-id (cond
|
||||||
(some? force-id) force-id
|
(some? force-id) force-id
|
||||||
keep-ids? (:id object)
|
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))
|
(loop [child-ids (seq (:shapes object))
|
||||||
new-direct-children []
|
new-direct-children []
|
||||||
|
@ -381,7 +388,8 @@
|
||||||
(let [new-object (cond-> object
|
(let [new-object (cond-> object
|
||||||
:always
|
:always
|
||||||
(assoc :id new-id
|
(assoc :id new-id
|
||||||
:parent-id parent-id)
|
:parent-id parent-id
|
||||||
|
:frame-id frame-id)
|
||||||
|
|
||||||
(some? (:shapes object))
|
(some? (:shapes object))
|
||||||
(assoc :shapes (mapv :id new-direct-children)))
|
(assoc :shapes (mapv :id new-direct-children)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue