From bdb16109d5e2d642ba95a7216c96724e79cd5221 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 7 Feb 2024 09:44:16 +0100 Subject: [PATCH] :bug: Fix empty components on v2 migration --- backend/src/app/features/components_v2.clj | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/src/app/features/components_v2.clj b/backend/src/app/features/components_v2.clj index 1aaa5e268..3506e415e 100644 --- a/backend/src/app/features/components_v2.clj +++ b/backend/src/app/features/components_v2.clj @@ -414,6 +414,16 @@ (update :pages-index update-vals fix-container) (d/update-when :components update-vals fix-container)))) + fix-empty-components + (fn [file-data] + (letfn [(fix-component [components id component] + (if (empty? (:objects component)) + (dissoc components id) + components))] + + (-> file-data + (d/update-when :components #(reduce-kv fix-component % %))))) + fix-misc-shape-issues (fn [file-data] (letfn [(fix-container [container] @@ -919,6 +929,7 @@ (fix-broken-paths) (fix-big-geometry-shapes) (fix-shape-geometry) + (fix-empty-components) (fix-completly-broken-shapes) (fix-bad-children) (fix-broken-parents)