From fb7d3676d2541b015fcd74b57795070da6822abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Wed, 31 Jan 2024 15:09:10 +0100 Subject: [PATCH] :bug: Fix components without id --- backend/src/app/features/components_v2.clj | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend/src/app/features/components_v2.clj b/backend/src/app/features/components_v2.clj index 3da089f40..f985ec5f9 100644 --- a/backend/src/app/features/components_v2.clj +++ b/backend/src/app/features/components_v2.clj @@ -602,6 +602,17 @@ (update :pages-index update-vals fix-container) (d/update-when :components update-vals fix-container)))) + fix-components-without-id + (fn [file-data] + ;; We have detected some components that have no :id attribute. + ;; Regenerate it from the components map. + (letfn [(fix-component [id component] + (if (some? (:id component)) + component + (assoc component :id id)))] + (-> file-data + (d/update-when :components #(d/mapm fix-component %))))) + remap-refs (fn [file-data] ;; Remap shape-refs so that they point to the near main. @@ -810,6 +821,7 @@ (fix-orphan-copies) (remove-nested-roots) (add-not-nested-roots) + (fix-components-without-id) (remap-refs) (fix-converted-copies) (transform-to-frames)