From 623b4a985831b61a54a87f06cbd10fca8f798991 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 25 Jan 2024 18:05:57 +0100 Subject: [PATCH] :bug: Remove empty text shapes on comp-v2 migration --- backend/src/app/features/components_v2.clj | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/src/app/features/components_v2.clj b/backend/src/app/features/components_v2.clj index 5842590200..03240a9044 100644 --- a/backend/src/app/features/components_v2.clj +++ b/backend/src/app/features/components_v2.clj @@ -243,13 +243,20 @@ fix-completly-broken-shapes (fn [file-data] (letfn [(update-object [objects id shape] - (if (nil? (:type shape)) + (cond + (nil? (:type shape)) (let [ids (cfh/get-children-ids objects id)] (-> objects (dissoc id) (as-> $ (reduce dissoc $ ids)) (d/update-in-when [(:parent-id shape) :shapes] (fn [shapes] (filterv #(not= id %) shapes))))) + + (and (cfh/text-shape? shape) + (not (seq (:content shape)))) + (dissoc objects id) + + :else objects)) (update-container [container]