Compare commits

...

1 Commits

Author SHA1 Message Date
Eva Marco
3330449e31 🐛 Fix shadow token reference validation 2026-01-20 09:43:59 +01:00
3 changed files with 14 additions and 8 deletions

View File

@@ -52,7 +52,8 @@
(let [form (mf/use-ctx context)
disabled? (or (and (some? form)
(or (not (:valid @form))
(seq (:external-errors @form))))
(seq (:reference-errors @form))
(seq (:extra-errors @form))))
(true? disabled))
handle-key-down-save
(mf/use-fn

View File

@@ -332,6 +332,7 @@
message (tr "workspace.tokens.resolved-value" (or resolved-value value))]
(swap! form update :errors dissoc :value)
(swap! form update :extra-errors dissoc :value)
(swap! form update :reference-errors dissoc :reference)
(if (= input-value (str resolved-value))
(reset! hint* {})
(reset! hint* {:message message :type "hint"})))))))]

View File

@@ -101,13 +101,6 @@
active-tab* (mf/use-state #(if (cft/is-reference? token) :reference :composite))
active-tab (deref active-tab*)
on-toggle-tab
(mf/use-fn
(mf/deps)
(fn [new-tab]
(let [new-tab (keyword new-tab)]
(reset! active-tab* new-tab))))
token
(mf/with-memo [token]
(or token {:type token-type}))
@@ -144,6 +137,17 @@
(fm/use-form :schema schema
:initial initial)
on-toggle-tab
(mf/use-fn
(mf/deps form)
(fn [new-tab]
(let [new-tab (keyword new-tab)]
(if (= new-tab :reference)
(swap! form assoc-in [:reference-errors :reference]
{:message "Need valid reference"})
(swap! form update :reference-errors dissoc :reference))
(reset! active-tab* new-tab))))
warning-name-change?
(not= (get-in @form [:data :name])
(:name initial))