From 146cd56ba561c9571bebaa04f2c4c09b146975da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Tue, 24 Oct 2023 17:02:01 +0200 Subject: [PATCH] :bug: Fix infite loop in some cases when resetting changes --- common/src/app/common/types/container.cljc | 15 --------------- common/src/app/common/types/file.cljc | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/common/src/app/common/types/container.cljc b/common/src/app/common/types/container.cljc index 8a14defd2..b487a2fba 100644 --- a/common/src/app/common/types/container.cljc +++ b/common/src/app/common/types/container.cljc @@ -344,21 +344,6 @@ [(remap-ids new-shape) (map remap-ids new-shapes)]))) -(defn get-top-instance - "The case of having an instance that contains another instances. - The topmost one, that is not part of other instance, is the Top instance" - [objects shape current-top] - (let [current-top (if (and - (not (ctk/main-instance? shape)) - (ctk/instance-head? shape)) - shape current-top) - parent-id (:parent-id shape) - parent (get objects parent-id)] - (if (= parent-id uuid/zero) - current-top - (get-top-instance objects parent current-top)))) - - (defn get-first-not-copy-parent "Go trough the parents until we find a shape that is not a copy of a component." [objects id] diff --git a/common/src/app/common/types/file.cljc b/common/src/app/common/types/file.cljc index 294214b84..90261f66a 100644 --- a/common/src/app/common/types/file.cljc +++ b/common/src/app/common/types/file.cljc @@ -205,7 +205,7 @@ (defn find-remote-shape "Recursively go back by the :shape-ref of the shape until find the correct shape of the original component" [container libraries shape] - (let [top-instance (ctn/get-top-instance (:objects container) shape nil) + (let [top-instance (ctn/get-component-shape (:objects container) shape) component-file (get-in libraries [(:component-file top-instance) :data]) component (ctkl/get-component component-file (:component-id top-instance) true) remote-shape (get-ref-shape component-file component shape)