mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 18:48:37 -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)
|
[(remap-ids new-shape)
|
||||||
(map remap-ids new-shapes)])))
|
(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
|
(defn get-first-not-copy-parent
|
||||||
"Go trough the parents until we find a shape that is not a copy of a component."
|
"Go trough the parents until we find a shape that is not a copy of a component."
|
||||||
[objects id]
|
[objects id]
|
||||||
|
|
|
@ -205,7 +205,7 @@
|
||||||
(defn find-remote-shape
|
(defn find-remote-shape
|
||||||
"Recursively go back by the :shape-ref of the shape until find the correct shape of the original component"
|
"Recursively go back by the :shape-ref of the shape until find the correct shape of the original component"
|
||||||
[container libraries shape]
|
[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-file (get-in libraries [(:component-file top-instance) :data])
|
||||||
component (ctkl/get-component component-file (:component-id top-instance) true)
|
component (ctkl/get-component component-file (:component-id top-instance) true)
|
||||||
remote-shape (get-ref-shape component-file component shape)
|
remote-shape (get-ref-shape component-file component shape)
|
||||||
|
|
Loading…
Add table
Reference in a new issue