0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 00:58:26 -05:00

🐛 Fix infite loop in some cases when resetting changes

This commit is contained in:
Andrés Moya 2023-10-24 17:02:01 +02:00
parent e4cadc36b0
commit 146cd56ba5
2 changed files with 1 additions and 16 deletions

View file

@ -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]

View file

@ -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)