From 9f2b96332c36e37bed109fae80323189ea0fa33e Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Thu, 26 Sep 2024 16:16:44 +0200 Subject: [PATCH] Fix up active themes tokens method --- common/src/app/common/types/tokens_lib.cljc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/src/app/common/types/tokens_lib.cljc b/common/src/app/common/types/tokens_lib.cljc index 7cf9837e1..1ca3e0987 100644 --- a/common/src/app/common/types/tokens_lib.cljc +++ b/common/src/app/common/types/tokens_lib.cljc @@ -605,14 +605,14 @@ (get-active-themes this))) (get-active-themes-set-tokens [this] - (mapcat (fn [x] - (->> (get x :sets) - (map (fn [y] - (-> - (get-set this y) - :tokens))))) - (get-active-themes this))) - + (reduce + (fn [acc cur] + (if (theme-active? this (:group cur) (:name cur)) + (into acc + (->> (get cur :sets) + (map #(-> (get-set this %) :tokens)))) + acc)) + (d/ordered-map) (tree-seq d/ordered-map? vals themes))) (validate [_] (and (valid-token-sets? sets) ;; TODO: validate set-groups