diff --git a/common/src/app/common/pages/changes_builder.cljc b/common/src/app/common/pages/changes_builder.cljc index 919c9e90c..3cf5c6100 100644 --- a/common/src/app/common/pages/changes_builder.cljc +++ b/common/src/app/common/pages/changes_builder.cljc @@ -669,3 +669,13 @@ :id id}) (update :undo-changes d/preconj {:type :del-component :id id}))) + +(defn ignore-remote + [changes] + (letfn [(add-ignore-remote + [change-list] + (->> change-list + (mapv #(assoc % :ignore-remote? true))))] + (-> changes + (update :redo-changes add-ignore-remote) + (update :undo-changes add-ignore-remote)))) diff --git a/frontend/src/app/main/data/workspace/changes.cljs b/frontend/src/app/main/data/workspace/changes.cljs index 43a520b27..771b873ce 100644 --- a/frontend/src/app/main/data/workspace/changes.cljs +++ b/frontend/src/app/main/data/workspace/changes.cljs @@ -55,8 +55,8 @@ (defn update-shapes ([ids update-fn] (update-shapes ids update-fn nil)) - ([ids update-fn {:keys [reg-objects? save-undo? stack-undo? attrs ignore-tree page-id] - :or {reg-objects? false save-undo? true stack-undo? false}}] + ([ids update-fn {:keys [reg-objects? save-undo? stack-undo? attrs ignore-tree page-id ignore-remote?] + :or {reg-objects? false save-undo? true stack-undo? false ignore-remote? false}}] (us/assert ::coll-of-uuid ids) (us/assert fn? update-fn) @@ -85,7 +85,8 @@ changes (add-group-id changes state)] (rx/concat (if (seq (:redo-changes changes)) - (let [changes (cond-> changes reg-objects? (pcb/resize-parents ids))] + (let [changes (cond-> changes reg-objects? (pcb/resize-parents ids)) + changes (cond-> changes ignore-remote? (pcb/ignore-remote))] (rx/of (commit-changes changes))) (rx/empty)) diff --git a/frontend/src/app/main/data/workspace/notifications.cljs b/frontend/src/app/main/data/workspace/notifications.cljs index e4ea1543c..7002f8ea1 100644 --- a/frontend/src/app/main/data/workspace/notifications.cljs +++ b/frontend/src/app/main/data/workspace/notifications.cljs @@ -221,7 +221,9 @@ (dch/update-indices page-id changes)) ;; We update `position-data` from the incoming message - changes (->> changes (mapv update-position-data)) + changes (->> changes + (mapv update-position-data) + (d/removev :ignore-remote?)) changes-by-pages (group-by :page-id changes)] (rx/merge diff --git a/frontend/src/app/main/data/workspace/texts.cljs b/frontend/src/app/main/data/workspace/texts.cljs index 12abce5d6..53343202a 100644 --- a/frontend/src/app/main/data/workspace/texts.cljs +++ b/frontend/src/app/main/data/workspace/texts.cljs @@ -414,7 +414,7 @@ (let [ids (->> (keys props) (filter changed-text?))] (rx/of (dwu/start-undo-transaction undo-id) - (dch/update-shapes ids update-fn {:reg-objects? true :stack-undo? true}) + (dch/update-shapes ids update-fn {:reg-objects? true :stack-undo? true :ignore-remote? true}) (ptk/data-event :layout/update ids) (dwu/commit-undo-transaction undo-id)))))))) @@ -558,7 +558,7 @@ (fn [shape] (-> shape (assoc :position-data (get position-data (:id shape))))) - {:stack-undo? true :reg-objects? false})) + {:stack-undo? true :reg-objects? false :ignore-remote? true})) (rx/of (fn [state] (dissoc state ::update-position-data-debounce ::update-position-data))))))))