mirror of
https://github.com/penpot/penpot.git
synced 2025-06-02 00:51:38 +02:00
Merge pull request #4166 from penpot/hiru-bugfixes-7
🐛 Fix swap in main component with duplicated pages
This commit is contained in:
commit
35d8fd9d97
2 changed files with 16 additions and 12 deletions
|
@ -1022,6 +1022,7 @@
|
||||||
(dwlh/generate-sync-library it file-id :colors asset-id library-id state))
|
(dwlh/generate-sync-library it file-id :colors asset-id library-id state))
|
||||||
(when sync-typographies?
|
(when sync-typographies?
|
||||||
(dwlh/generate-sync-library it file-id :typographies asset-id library-id state))])
|
(dwlh/generate-sync-library it file-id :typographies asset-id library-id state))])
|
||||||
|
|
||||||
file-changes (reduce
|
file-changes (reduce
|
||||||
pcb/concat-changes
|
pcb/concat-changes
|
||||||
(-> (pcb/empty-changes it)
|
(-> (pcb/empty-changes it)
|
||||||
|
@ -1035,13 +1036,10 @@
|
||||||
|
|
||||||
changes (pcb/concat-changes library-changes file-changes)
|
changes (pcb/concat-changes library-changes file-changes)
|
||||||
|
|
||||||
|
|
||||||
find-frames (fn [change]
|
find-frames (fn [change]
|
||||||
(->> (ch/frames-changed file change)
|
(->> (ch/frames-changed file change)
|
||||||
(map #(assoc %1 :page-id (:page-id change)))))
|
(map #(assoc %1 :page-id (:page-id change)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
updated-frames (->> changes
|
updated-frames (->> changes
|
||||||
:redo-changes
|
:redo-changes
|
||||||
(mapcat find-frames)
|
(mapcat find-frames)
|
||||||
|
|
|
@ -595,8 +595,14 @@
|
||||||
instance, and all its children, from the given component."
|
instance, and all its children, from the given component."
|
||||||
[changes libraries container shape-id reset? components-v2]
|
[changes libraries container shape-id reset? components-v2]
|
||||||
(log/debug :msg "Sync shape direct" :shape (str shape-id) :reset? reset?)
|
(log/debug :msg "Sync shape direct" :shape (str shape-id) :reset? reset?)
|
||||||
(let [shape-inst (ctn/get-shape container shape-id)]
|
(let [shape-inst (ctn/get-shape container shape-id)
|
||||||
(if (ctk/in-component-copy? shape-inst)
|
library (dm/get-in libraries [(:component-file shape-inst) :data])
|
||||||
|
component (or (ctkl/get-component library (:component-id shape-inst))
|
||||||
|
(and reset?
|
||||||
|
(ctkl/get-deleted-component library (:component-id shape-inst))))
|
||||||
|
component-shape (ctn/get-component-shape (:objects container) shape-inst)]
|
||||||
|
(if (and (ctk/in-component-copy? shape-inst)
|
||||||
|
(or (= (:id component) (:component-id component-shape)) reset?)) ; In a normal sync, we don't want to sync remote mains, only near
|
||||||
(let [redirect-shaperef (partial redirect-shaperef container libraries)
|
(let [redirect-shaperef (partial redirect-shaperef container libraries)
|
||||||
library (dm/get-in libraries [(:component-file shape-inst) :data])
|
library (dm/get-in libraries [(:component-file shape-inst) :data])
|
||||||
component (or (ctkl/get-component library (:component-id shape-inst))
|
component (or (ctkl/get-component library (:component-id shape-inst))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue