0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

Extract missing reference error check

This commit is contained in:
Florian Schroedl 2024-06-25 16:30:57 +02:00
parent 2c42ca5a4b
commit af374276e4
2 changed files with 6 additions and 1 deletions

View file

@ -83,7 +83,7 @@
(let [{:keys [errors resolved-value] :as resolved-token} (get resolved-tokens token-id)]
(cond
resolved-value (p/resolved resolved-token)
(= #{:style-dictionary/missing-reference} errors) (p/rejected :error/token-missing-reference)
(sd/missing-reference-error? errors) (p/rejected :error/token-missing-reference)
:else (p/rejected :error/unknown-error))))))))))
(defn use-debonced-resolve-callback

View file

@ -77,6 +77,11 @@
errors)
(str/join "\n")))
(defn missing-reference-error?
[errors]
(and (set? errors)
(get errors :style-dictionary/missing-reference)))
(defn tokens-name-map [tokens]
(->> tokens
(map (fn [[_ x]] [(:name x) x]))