mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
🐛 Fix error message on combobox
This commit is contained in:
parent
9f6fc030b1
commit
9067dd3d04
@ -106,8 +106,6 @@
|
||||
(mf/with-memo [raw-tokens-by-type token-type]
|
||||
(csu/filter-tokens-for-input raw-tokens-by-type token-type))
|
||||
|
||||
_ (pp/pprint raw-tokens-by-type)
|
||||
_ (pp/pprint filtered-tokens-by-type)
|
||||
|
||||
visible-options
|
||||
(mf/with-memo [filtered-tokens-by-type token]
|
||||
@ -282,15 +280,21 @@
|
||||
(fn [error]
|
||||
((:error/fn error) (:error/value error))))))
|
||||
(rx/subs! (fn [{:keys [error value]}]
|
||||
(let [touched? (get-in @form [:touched name])]
|
||||
(let [touched? (get-in @form [:touched name])
|
||||
current-value (get-in @form [:data name] "")
|
||||
valid-ref? (re-matches cto/token-ref-validation-regex current-value)]
|
||||
(when touched?
|
||||
(if error
|
||||
(do
|
||||
(swap! form assoc-in [:extra-errors name] {:message error})
|
||||
(reset! hint* {:message error :type "error"}))
|
||||
(let [message (tr "workspace.tokens.resolved-value" value)]
|
||||
(swap! form update :extra-errors dissoc name)
|
||||
(reset! hint* {:message message :type "hint"}))))))))]
|
||||
(if (and (not (str/blank? current-value)) (not valid-ref?))
|
||||
(let [message (tr "workspace.tokens.invalid-value" (str current-value))]
|
||||
(swap! form assoc-in [:extra-errors name] {:message message})
|
||||
(reset! hint* {:message message :type "error"}))
|
||||
(let [message (tr "workspace.tokens.resolved-value" value)]
|
||||
(swap! form update :extra-errors dissoc name)
|
||||
(reset! hint* {:message message :type "hint"})))))))))]
|
||||
(fn []
|
||||
(rx/dispose! subs))))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user