diff --git a/common/src/app/common/files/changes_builder.cljc b/common/src/app/common/files/changes_builder.cljc index 16cdeeed84..442fb14660 100644 --- a/common/src/app/common/files/changes_builder.cljc +++ b/common/src/app/common/files/changes_builder.cljc @@ -485,7 +485,8 @@ del-change {:type :del-obj :id (:id obj) - :page-id (::page-id (meta changes))} + :page-id (::page-id (meta changes)) + :ignore-touched true} restore-touched-change {:type :mod-obj @@ -694,6 +695,7 @@ (some? shape) (conj {:type :add-obj :id id + :ignore-touched true :page-id page-id :parent-id (:parent-id shape) :frame-id (:frame-id shape) diff --git a/common/test/common_tests/logic/composable_runner_test.cljc b/common/test/common_tests/logic/composable_runner_test.cljc index d87fa124a0..379c8de27b 100644 --- a/common/test/common_tests/logic/composable_runner_test.cljc +++ b/common/test/common_tests/logic/composable_runner_test.cljc @@ -15,11 +15,25 @@ [app.common.test-helpers.composable.core :as tm] [app.common.test-helpers.files :as thf] [app.common.test-helpers.ids-map :as thi] + [app.common.test-helpers.normalize :as thn] [app.common.uuid :as uuid] [clojure.test :as t])) (t/use-fixtures :each thi/test-fixture) +(t/deftest undo-main-child-structure-restores-remote-sync-state + (let [initial (setup/nested-component-with-copy) + updated (-> initial + (r/step (n/change-property :main2-nested-head :opacity 0.4)) r/settle + (r/step (n/update-main :main2-nested-head)) r/settle)] + (t/is (:remote-synced (tm/resolve-shape updated :main2-nested-head))) + (doseq [op [(n/remove-child :main1-child) (n/add-child :main1-root :added-child)]] + (let [changed (-> updated (r/step op) r/settle) + undone (r/step changed (n/undo)) + redone (r/step undone (n/redo))] + (t/is (true? (= (thn/normalize-file (tm/file updated)) (thn/normalize-file (tm/file undone))))) + (t/is (true? (= (thn/normalize-file (tm/file changed)) (thn/normalize-file (tm/file redone))))))))) + (def ^:private original setup/labeled-fill) (def ^:private red "#ff0000") (def ^:private green "#00ff00")