From dc67056a8c58fb4c3987d9df4ae6a980cf9e7af3 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Fri, 9 Feb 2024 12:25:47 +0100 Subject: [PATCH] :bug: Fix components without root shape for v2 migration --- backend/src/app/features/components_v2.clj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/app/features/components_v2.clj b/backend/src/app/features/components_v2.clj index f1c2dc469..72f416bdf 100644 --- a/backend/src/app/features/components_v2.clj +++ b/backend/src/app/features/components_v2.clj @@ -431,9 +431,11 @@ fix-empty-components (fn [file-data] (letfn [(fix-component [components id component] - (if (empty? (:objects component)) - (dissoc components id) - components))] + (let [root-shape (ctst/get-shape component (:id component))] + (if (or (empty? (:objects component)) + (nil? root-shape)) + (dissoc components id) + components)))] (-> file-data (d/update-when :components #(reduce-kv fix-component % %)))))