From 8d65998cc3f46402653dc2c35d243b5560485e0a Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Thu, 8 Feb 2024 12:41:12 +0100 Subject: [PATCH] :bug: Fix remove nested roots on components v2 migration --- backend/src/app/features/components_v2.clj | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/backend/src/app/features/components_v2.clj b/backend/src/app/features/components_v2.clj index 13e90d254..16affe6c9 100644 --- a/backend/src/app/features/components_v2.clj +++ b/backend/src/app/features/components_v2.clj @@ -944,12 +944,12 @@ ;; ;; WARNING: THIS SHOULD BE CALLED AT THE END OF THE PROCESS. (letfn [(fix-container [container] - (d/update-when container :objects update-vals fix-shape)) - - (fix-shape [shape] - (cond-> shape + (reduce fix-shape container (ctn/shapes-seq container))) + (fix-shape [container shape] + (cond-> container (@detached-ids (:shape-ref shape)) - (ctk/detach-shape)))] + (detach-shape shape)))] + (-> file-data (update :pages-index update-vals fix-container) (d/update-when :components update-vals fix-container))))] @@ -986,8 +986,7 @@ (fix-false-copies) (fix-component-root-without-component) (fix-copies-of-detached); <- Do not add fixes after this and fix-orphan-copies call - ; This extra call to fix-orphan-copies after fix-copies-of-detached because we can have detached subtrees with invalid shape-ref attributes - (fix-orphan-copies)))) + ))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; COMPONENTS MIGRATION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;