mirror of
https://github.com/penpot/penpot.git
synced 2025-02-22 06:46:40 -05:00
Merge pull request #3923 from penpot/hiru-components-bugfix-1
Some components bugfix
This commit is contained in:
commit
86a4833c4a
1 changed files with 22 additions and 5 deletions
|
@ -603,6 +603,23 @@
|
|||
(generate-detach-instance changes container shape-id))))
|
||||
changes)))
|
||||
|
||||
(defn- find-main-container
|
||||
"Find the container that has the main shape."
|
||||
[container-inst shape-inst shape-main library component]
|
||||
(loop [shape-inst' shape-inst
|
||||
component' component]
|
||||
(let [container (ctf/get-component-container library component')] ; TODO: this won't work if some intermediate component is in a different library
|
||||
(if (some? (ctn/get-shape container (:id shape-main))) ; for this to work we need to have access to the libraries list here
|
||||
container
|
||||
(let [parent (ctn/get-shape container-inst (:parent-id shape-inst'))
|
||||
shape-inst' (ctn/get-head-shape (:objects container-inst) parent)
|
||||
component' (or (ctkl/get-component library (:component-id shape-inst'))
|
||||
(ctkl/get-deleted-component library (:component-id shape-inst')))]
|
||||
(if (some? component)
|
||||
(recur shape-inst'
|
||||
component')
|
||||
nil))))))
|
||||
|
||||
(defn- generate-sync-shape-direct-recursive
|
||||
[changes container shape-inst component library shape-main root-inst root-main reset? initial-root? redirect-shaperef components-v2]
|
||||
(log/debug :msg "Sync shape direct recursive"
|
||||
|
@ -639,7 +656,7 @@
|
|||
set-remote-synced?
|
||||
(change-remote-synced shape-inst container true))
|
||||
|
||||
component-container (ctf/get-component-container library component)
|
||||
component-container (find-main-container container shape-inst shape-main library component)
|
||||
|
||||
children-inst (vec (ctn/get-direct-children container shape-inst))
|
||||
children-main (vec (ctn/get-direct-children component-container shape-main))
|
||||
|
@ -948,11 +965,11 @@
|
|||
(:id parent-shape)
|
||||
(:frame-id parent-shape)))
|
||||
|
||||
(nil? (:shape-ref original-shape))
|
||||
(assoc :shape-ref (:id original-shape))
|
||||
|
||||
set-remote-synced?
|
||||
(assoc :remote-synced true))))
|
||||
(assoc :remote-synced true)
|
||||
|
||||
:always
|
||||
(assoc :shape-ref (:id original-shape)))))
|
||||
|
||||
update-original-shape (fn [original-shape _new-shape]
|
||||
original-shape)
|
||||
|
|
Loading…
Add table
Reference in a new issue