mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 17:18:21 -05:00
🐛 Fix infite loop in some cases when resetting changes
This commit is contained in:
parent
e4cadc36b0
commit
146cd56ba5
2 changed files with 1 additions and 16 deletions
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue