mirror of
https://github.com/penpot/penpot.git
synced 2026-11-27 21:57:52 +00:00
♻️ Add skip-validate-changes helper
apply-changes-local and the page index worker drop the :validate-shapes changes with the same inline filter. Move it to app.common.files.changes as skip-validate-changes, next to the :validate-shapes change, so it is easy to find every place that skips the validation if it changes in the future. AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
1240f3abdc
commit
65dfeb3d87
@ -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 _ _]
|
||||
|
||||
@ -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))))
|
||||
|
||||
@ -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))))))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user