From 749c36908083dc99cac124963c3c24a25a8c5c37 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 9 Sep 2024 12:23:33 +0200 Subject: [PATCH] :sparkles: Add less verbose shape validation --- common/src/app/common/files/changes.cljc | 2 +- common/src/app/common/types/shape.cljc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/files/changes.cljc b/common/src/app/common/files/changes.cljc index f861cf3f1f..71ea76f255 100644 --- a/common/src/app/common/files/changes.cljc +++ b/common/src/app/common/files/changes.cljc @@ -371,7 +371,7 @@ (not= shape-old shape-new)) (dm/verify! "expected valid shape" - (and (cts/check-shape! shape-new) + (and (cts/valid-shape? shape-new) (cts/shape? shape-new))))))] (->> (into #{} (map :page-id) items) diff --git a/common/src/app/common/types/shape.cljc b/common/src/app/common/types/shape.cljc index b502c4c650..1f4f025ca3 100644 --- a/common/src/app/common/types/shape.cljc +++ b/common/src/app/common/types/shape.cljc @@ -354,6 +354,9 @@ (def check-shape! (sm/check-fn schema:shape)) +(def valid-shape? + (sm/lazy-validator schema:shape)) + (defn has-images? [{:keys [fills strokes]}] (or (some :fill-image fills)