From b4d8a764f9d03f1a20c8edae675383ccdabe4f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Tue, 19 May 2026 17:09:34 +0200 Subject: [PATCH] wip --- .../app/main/data/workspace/tokens/errors.cljs | 16 ++++++++++------ .../app/main/ui/workspace/tokens/management.cljs | 3 --- .../management/forms/controls/combobox.cljs | 5 ++++- .../forms/controls/fonts_combobox.cljs | 4 +++- .../tokens/management/forms/controls/input.cljs | 4 +++- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/main/data/workspace/tokens/errors.cljs b/frontend/src/app/main/data/workspace/tokens/errors.cljs index 7338663b2d..0e7a78de9b 100644 --- a/frontend/src/app/main/data/workspace/tokens/errors.cljs +++ b/frontend/src/app/main/data/workspace/tokens/errors.cljs @@ -141,9 +141,11 @@ :error/value to produce the message. Falls back to :message for errors that originate from schema-validation (which have no :error/fn)." [error] - (if-let [f (:error/fn error)] - (f (:error/value error)) - (:message error))) + (if error + (if-let [f (:error/fn error)] + (f (:error/value error)) + (:message error)) + (tr "labels.unknown-error"))) (defn resolve-error-assoc-message "Returns the error map with a :message key set to the resolved human- @@ -151,9 +153,11 @@ is called with :error/value; otherwise the map is returned unchanged (it is expected to already carry a :message from schema-validation)." [error] - (if-let [f (:error/fn error)] - (assoc error :message (f (:error/value error))) - error)) + (if error + (if-let [f (:error/fn error)] + (assoc error :message (f (:error/value error))) + error) + (assoc error :message (tr "labels.unknown-error")))) (defn humanize-errors [errors] (->> errors diff --git a/frontend/src/app/main/ui/workspace/tokens/management.cljs b/frontend/src/app/main/ui/workspace/tokens/management.cljs index e3a0dafed1..3d30fcacb2 100644 --- a/frontend/src/app/main/ui/workspace/tokens/management.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/management.cljs @@ -111,9 +111,6 @@ (mf/with-memo [active-tokens selected-token-set-tokens] (merge active-tokens selected-token-set-tokens)) - tokens - (sd/use-resolved-tokens* tokens) - ;; Group tokens by their type tokens-by-type (mf/with-memo [tokens selected-token-set-tokens] diff --git a/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/combobox.cljs b/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/combobox.cljs index 137551c260..6ab6f3ce0a 100644 --- a/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/combobox.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/combobox.cljs @@ -13,6 +13,7 @@ [app.config :as cf] [app.main.data.style-dictionary :as sd] [app.main.data.tokenscript :as ts] + [app.main.data.workspace.tokens.errors :as wte] [app.main.ui.context :as muc] [app.main.ui.ds.buttons.icon-button :refer [icon-button*]] [app.main.ui.ds.controls.input :as ds] @@ -60,7 +61,9 @@ resolved-value)] (if resolved-value (rx/of {:value resolved-value}) - (rx/of {:error (first errors)})))))))) + (rx/of {:error (if errors + (first errors) + (wte/error-with-value :error/unknown value))})))))))) (mf/defc value-combobox* [{:keys [name tokens token token-type empty-to-end ref] :rest props}] diff --git a/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/fonts_combobox.cljs b/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/fonts_combobox.cljs index d663e9defe..8053d8fd13 100644 --- a/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/fonts_combobox.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/fonts_combobox.cljs @@ -78,7 +78,9 @@ resolved-value)] (if resolved-value (rx/of {:value resolved-value}) - (rx/of {:error (first errors)})))))))) + (rx/of {:error (if errors + (first errors) + (wte/error-with-value :error/unknown value))})))))))) (mf/defc fonts-combobox* [{:keys [token tokens name] :rest props}] diff --git a/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/input.cljs b/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/input.cljs index 3e20c5a2e1..ff8d77387c 100644 --- a/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/input.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/input.cljs @@ -181,7 +181,9 @@ resolved-value)] (if resolved-value (rx/of {:value resolved-value}) - (rx/of {:error (first errors)})))))))) + (rx/of {:error (if errors + (first errors) + (wte/error-with-value :error/unknown value))})))))))) (mf/defc input* [{:keys [name tokens token] :rest props}]