From 0d751b0e20b9622e707c94de2d16820f711c897e Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Thu, 21 Mar 2024 19:42:42 +0100 Subject: [PATCH] :bug: Fix Crash on moving a frame with copy outside a component --- frontend/src/app/main/data/workspace/transforms.cljs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index 15622d4dd..80e38ab3e 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -910,6 +910,11 @@ (mapcat #(cfh/get-children-with-self objects (:id %))) (map :id)) + child-heads + (->> moving-shapes-ids + (mapcat #(ctn/get-child-heads objects %)) + (map :id)) + changes (-> (pcb/empty-changes it page-id) (pcb/with-objects objects) @@ -921,10 +926,7 @@ (pcb/update-shapes moving-shapes-children-ids #(dissoc % :component-root))) ;; Add component-root property when moving a component outside a component (cond-> (not (ctn/get-instance-root objects frame)) - (pcb/update-shapes moving-shapes-ids (fn [shape] - (if (ctk/instance-head? shape) - (assoc shape :component-root true) - shape)))) + (pcb/update-shapes child-heads #(assoc % :component-root true))) (pcb/update-shapes moving-shapes-ids #(cond-> % (cfh/frame-shape? %) (assoc :hide-in-viewer true))) (pcb/update-shapes shape-ids-to-detach ctk/detach-shape) (pcb/change-parent frame-id moving-shapes drop-index)