mirror of
https://github.com/penpot/penpot.git
synced 2025-05-05 12:25:58 +02:00
⚡ Don't create keys seq on each rerender on token-pill component
This commit is contained in:
parent
5575a66b8d
commit
bccc90f5a2
1 changed files with 3 additions and 3 deletions
|
@ -138,9 +138,9 @@
|
||||||
;; we don't need to perform this regex operation on each rerender
|
;; we don't need to perform this regex operation on each rerender
|
||||||
(defn contains-reference-value?
|
(defn contains-reference-value?
|
||||||
"Extracts the value between `{}` in a string and checks if it's in the provided vector."
|
"Extracts the value between `{}` in a string and checks if it's in the provided vector."
|
||||||
[text values]
|
[text active-tokens]
|
||||||
(let [match (second (re-find #"\{([^}]+)\}" text))]
|
(let [match (second (re-find #"\{([^}]+)\}" text))]
|
||||||
(boolean (some #(= % match) values))))
|
(contains? active-tokens match)))
|
||||||
|
|
||||||
(mf/defc token-pill
|
(mf/defc token-pill
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
|
@ -156,7 +156,7 @@
|
||||||
|
|
||||||
is-viewer (not can-edit?)
|
is-viewer (not can-edit?)
|
||||||
ref-not-in-active-set (and is-reference?
|
ref-not-in-active-set (and is-reference?
|
||||||
(not (contains-reference-value? value (keys active-theme-tokens))))
|
(not (contains-reference-value? value active-theme-tokens)))
|
||||||
|
|
||||||
no-valid-value (seq errors)
|
no-valid-value (seq errors)
|
||||||
errors? (or ref-not-in-active-set
|
errors? (or ref-not-in-active-set
|
||||||
|
|
Loading…
Add table
Reference in a new issue