From bccc90f5a23b8edf8d5c54bb7cd30d0cb6bdd5a3 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 4 Feb 2025 16:57:11 +0100 Subject: [PATCH] :zap: Don't create keys seq on each rerender on token-pill component --- frontend/src/app/main/ui/workspace/tokens/token_pill.cljs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/token_pill.cljs b/frontend/src/app/main/ui/workspace/tokens/token_pill.cljs index 2d0dc0927..395291c85 100644 --- a/frontend/src/app/main/ui/workspace/tokens/token_pill.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/token_pill.cljs @@ -138,9 +138,9 @@ ;; we don't need to perform this regex operation on each rerender (defn contains-reference-value? "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))] - (boolean (some #(= % match) values)))) + (contains? active-tokens match))) (mf/defc token-pill {::mf/wrap-props false} @@ -156,7 +156,7 @@ is-viewer (not can-edit?) 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) errors? (or ref-not-in-active-set