diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index 4fbf5d1e0..23e69b8f5 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -1022,6 +1022,7 @@ (dwlh/generate-sync-library it file-id :colors asset-id library-id state)) (when sync-typographies? (dwlh/generate-sync-library it file-id :typographies asset-id library-id state))]) + file-changes (reduce pcb/concat-changes (-> (pcb/empty-changes it) @@ -1035,17 +1036,14 @@ changes (pcb/concat-changes library-changes file-changes) + find-frames (fn [change] + (->> (ch/frames-changed file change) + (map #(assoc %1 :page-id (:page-id change))))) - find-frames (fn [change] - (->> (ch/frames-changed file change) - (map #(assoc %1 :page-id (:page-id change))))) - - - - updated-frames (->> changes - :redo-changes - (mapcat find-frames) - distinct)] + updated-frames (->> changes + :redo-changes + (mapcat find-frames) + distinct)] (log/debug :msg "SYNC-FILE finished" :js/rchanges (log-changes (:redo-changes changes) diff --git a/frontend/src/app/main/data/workspace/libraries_helpers.cljs b/frontend/src/app/main/data/workspace/libraries_helpers.cljs index fd830bb20..ae5c52f66 100644 --- a/frontend/src/app/main/data/workspace/libraries_helpers.cljs +++ b/frontend/src/app/main/data/workspace/libraries_helpers.cljs @@ -595,8 +595,14 @@ instance, and all its children, from the given component." [changes libraries container shape-id reset? components-v2] (log/debug :msg "Sync shape direct" :shape (str shape-id) :reset? reset?) - (let [shape-inst (ctn/get-shape container shape-id)] - (if (ctk/in-component-copy? shape-inst) + (let [shape-inst (ctn/get-shape container shape-id) + 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) library (dm/get-in libraries [(:component-file shape-inst) :data]) component (or (ctkl/get-component library (:component-id shape-inst))