From f3616c68a0181dbd2c22eb8710af41f948fb6640 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 7 Jul 2025 11:41:17 +0200 Subject: [PATCH] :sparkles: Improve decode empty string for path content --- common/src/app/common/types/color.cljc | 1 + common/src/app/common/types/path/impl.cljc | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/src/app/common/types/color.cljc b/common/src/app/common/types/color.cljc index 7d55b99c19..37c909d4a2 100644 --- a/common/src/app/common/types/color.cljc +++ b/common/src/app/common/types/color.cljc @@ -117,6 +117,7 @@ [:ref-id {:optional true} ::sm/uuid] [:ref-file {:optional true} ::sm/uuid]]) +;; This schema represent an "applied color" (def schema:color [:and [:merge {:title "Color"} diff --git a/common/src/app/common/types/path/impl.cljc b/common/src/app/common/types/path/impl.cljc index 5ec185f1a4..ae1520e78b 100644 --- a/common/src/app/common/types/path/impl.cljc +++ b/common/src/app/common/types/path/impl.cljc @@ -20,7 +20,8 @@ [app.common.schema.generators :as sg] [app.common.svg.path :as svg.path] [app.common.transit :as t] - [app.common.types.path :as-alias path]) + [app.common.types.path :as-alias path] + [cuerdas.core :as str]) (:import #?(:cljs [goog.string StringBuffer] :clj [java.nio ByteBuffer ByteOrder]))) @@ -530,7 +531,9 @@ :decode/json (fn [s] (cond (string? s) - (from-string s) + (if (str/empty? s) + (from-plain []) + (from-string s)) (vector? s) (let [decode-fn (deref decoder)]