diff --git a/common/src/app/common/files/changes.cljc b/common/src/app/common/files/changes.cljc index 2ad7753e8a..7202eb84f1 100644 --- a/common/src/app/common/files/changes.cljc +++ b/common/src/app/common/files/changes.cljc @@ -1181,6 +1181,12 @@ ;; --- Validate Shapes +(defn skip-validate-changes + "Remove the :validate-shapes changes, for data where the shapes can't + be validated (e.g. without the full file or its libraries)." + [changes] + (remove #(= :validate-shapes (:type %)) changes)) + #?(:clj (defmethod process-change :validate-shapes [data _ _] diff --git a/common/src/app/common/files/changes_builder.cljc b/common/src/app/common/files/changes_builder.cljc index a42e1dcedb..01b7ee3b49 100644 --- a/common/src/app/common/files/changes_builder.cljc +++ b/common/src/app/common/files/changes_builder.cljc @@ -199,7 +199,7 @@ new-changes (if (< index (count redo-changes)) (->> (subvec (:redo-changes changes) index) ;; Validation only makes sense on the real file data - (remove #(= :validate-shapes (:type %))) + (cfc/skip-validate-changes) (map #(-> % (assoc :page-id uuid/zero) (dissoc :component-id)))) diff --git a/common/test/common_tests/files_changes_test.cljc b/common/test/common_tests/files_changes_test.cljc index ca73e9b020..074a71ce6b 100644 --- a/common/test/common_tests/files_changes_test.cljc +++ b/common/test/common_tests/files_changes_test.cljc @@ -1644,3 +1644,10 @@ (t/is (seq (:redo-changes changes))) (t/is (not-any? #(= :validate-shapes (:type %)) (:redo-changes changes))))) +(t/deftest skip-validate-changes + (let [changes [{:type :mod-obj :id (uuid/next)} + {:type :validate-shapes :page-id (uuid/next) :shape-ids []} + {:type :del-obj :id (uuid/next)}]] + (t/is (= [:mod-obj :del-obj] + (map :type (ch/skip-validate-changes changes)))))) +