From e4cadc36b0036002550bdb04e1d25faeff10c37a Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 30 Oct 2023 19:57:44 +0100 Subject: [PATCH] :bug: Fix problem when creating child and update component --- common/src/app/common/types/shape_tree.cljc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/common/src/app/common/types/shape_tree.cljc b/common/src/app/common/types/shape_tree.cljc index 2798c9ff87..c3974656c7 100644 --- a/common/src/app/common/types/shape_tree.cljc +++ b/common/src/app/common/types/shape_tree.cljc @@ -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)))