From 17a208d67bfa2e0eb0c649116d9a7c94a603749d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Wed, 24 Jan 2024 15:59:39 +0100 Subject: [PATCH] :bug: Add validation fix for false non root copies --- backend/src/app/features/components_v2.clj | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/src/app/features/components_v2.clj b/backend/src/app/features/components_v2.clj index d2cc547ed..c09e7251d 100644 --- a/backend/src/app/features/components_v2.clj +++ b/backend/src/app/features/components_v2.clj @@ -486,15 +486,18 @@ fix-false-copies (fn [file-data] ;; Find component heads that are not main-instance but have not :shape-ref. + ;; Also shapes that have :shape-ref but are not in a copy. (letfn [(fix-container [container] (d/update-when container :objects update-vals (partial fix-shape container))) (fix-shape [container shape] - (if (and (ctk/instance-head? shape) - (not (ctk/main-instance? shape)) - (not (ctk/in-component-copy? shape))) + (if (or (and (ctk/instance-head? shape) + (not (ctk/main-instance? shape)) + (not (ctk/in-component-copy? shape))) + (and (ctk/in-component-copy? shape) + (nil? (ctn/get-head-shape (:objects container) shape {:allow-main? true})))) (detach-shape container shape) shape))] (-> file-data