From 21b2c0c26a70d2ade8969de9b861f0faebbcc986 Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Wed, 12 Mar 2025 16:34:30 +0100 Subject: [PATCH] :bug: Fix token unset when flex layout is applied --- common/src/app/common/files/shapes_helpers.cljc | 7 ++++--- frontend/src/app/main/data/workspace/shapes.cljs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/src/app/common/files/shapes_helpers.cljc b/common/src/app/common/files/shapes_helpers.cljc index e07e0631a..772b71e63 100644 --- a/common/src/app/common/files/shapes_helpers.cljc +++ b/common/src/app/common/files/shapes_helpers.cljc @@ -38,7 +38,7 @@ [shape changes])) (defn prepare-move-shapes-into-frame - [changes frame-id shapes objects] + [changes frame-id shapes objects remove-layout-data?] (let [parent-id (dm/get-in objects [frame-id :parent-id]) shapes (remove #(= % parent-id) shapes) to-move (->> shapes @@ -46,7 +46,8 @@ (not-empty))] (if to-move (-> changes - (cond-> (not (ctl/any-layout? objects frame-id)) + (cond-> (and remove-layout-data? + (not (ctl/any-layout? objects frame-id))) (pcb/update-shapes shapes ctl/remove-layout-item-data)) (pcb/update-shapes shapes #(cond-> % (cfh/frame-shape? %) (assoc :hide-in-viewer true))) (pcb/change-parent frame-id to-move 0) @@ -133,7 +134,7 @@ (prepare-add-shape changes shape objects) changes - (prepare-move-shapes-into-frame changes (:id shape) selected' objects) + (prepare-move-shapes-into-frame changes (:id shape) selected' objects false) changes (cond-> changes diff --git a/frontend/src/app/main/data/workspace/shapes.cljs b/frontend/src/app/main/data/workspace/shapes.cljs index e384bf190..cceea35af 100644 --- a/frontend/src/app/main/data/workspace/shapes.cljs +++ b/frontend/src/app/main/data/workspace/shapes.cljs @@ -150,7 +150,7 @@ changes (-> (pcb/empty-changes it page-id) (pcb/with-objects objects)) - changes (cfsh/prepare-move-shapes-into-frame changes frame-id shapes objects)] + changes (cfsh/prepare-move-shapes-into-frame changes frame-id shapes objects true)] (if (some? changes) (rx/of (dch/commit-changes changes))