0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-09 21:41:23 -05:00

🐛 Fix initial value of color bullet in form

This commit is contained in:
Andrés Moya 2025-03-17 17:24:49 +01:00 committed by Andrés Moya
parent fc17a1742a
commit 567fdd9619
2 changed files with 8 additions and 3 deletions

View file

@ -1233,7 +1233,8 @@ Will return a value that matches this schema:
(fn [tokens' cur]
(merge tokens' (:tokens (get-set this cur))))
tokens (order-theme-set theme)))
(d/ordered-map) active-themes)))
(d/ordered-map)
active-themes)))
(encode-dtcg [this]
(let [themes-xform

View file

@ -312,6 +312,7 @@
token-resolve-result* (mf/use-state (get resolved-tokens (wtt/token-identifier token)))
token-resolve-result (deref token-resolve-result*)
set-resolve-value
(mf/use-fn
(fn [token-or-err]
@ -320,12 +321,15 @@
v (cond
error?
token-or-err
warnings?
(:warnings {:warnings token-or-err})
:else
(:resolved-value token-or-err))]
(when color? (reset! color (if error? nil v)))
(reset! token-resolve-result* v))))
on-update-value-debounced (use-debonced-resolve-callback name-ref token active-theme-tokens set-resolve-value)
on-update-value (mf/use-fn
(mf/deps on-update-value-debounced)
@ -459,10 +463,10 @@
(when (k/enter? e)
(on-submit e))))]
;; Clear form token cache on mount
;; Clear form token cache on unmount
(mf/use-effect
(fn []
(reset! form-token-cache-atom nil)))
#(reset! form-token-cache-atom nil)))
;; Update the value when editing an existing token
;; so the user doesn't have to interact with the form to validate the token