From 3837ee5ff544ebb46041d0d3a7fb4f85a98878e5 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 19 Nov 2026 10:08:09 +0100 Subject: [PATCH] :bug: Keep a theme's disabled sets out of it when importing tokens Importing a tokens JSON whose `$themes` list a set as "disabled" in `selectedTokenSets` made that set part of the theme, so activating the theme turned it on: every key of `selectedTokenSets` was taken, whatever its state. A theme now takes only the sets that are not "disabled". Found by the components Qase run (Library Tokens suite). Test: `parse-theme-leaves-out-its-disabled-sets` (tokens-lib-test). AI-assisted-by: claude-opus-5-5 --- common/src/app/common/types/tokens_lib.cljc | 2 +- common/test/common_tests/types/tokens_lib_test.cljc | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/types/tokens_lib.cljc b/common/src/app/common/types/tokens_lib.cljc index 950cde98d9..711223e7a7 100644 --- a/common/src/app/common/types/tokens_lib.cljc +++ b/common/src/app/common/types/tokens_lib.cljc @@ -1660,7 +1660,7 @@ :is-source is-source :external-id id :sets (into #{} - (comp (remove (comp #{:disabled} val)) + (comp (remove (comp #{:disabled "disabled"} val)) (map key) xf-normalize-set-name (filter #(contains? sets %))) diff --git a/common/test/common_tests/types/tokens_lib_test.cljc b/common/test/common_tests/types/tokens_lib_test.cljc index 80d8119a1a..ba2ff3408f 100644 --- a/common/test/common_tests/types/tokens_lib_test.cljc +++ b/common/test/common_tests/types/tokens_lib_test.cljc @@ -1215,6 +1215,17 @@ :value "16px" :description ""})))))) +(t/deftest parse-theme-leaves-out-its-disabled-sets + (let [json {"light" {"color" {"$type" "color" "$value" "#ffffff"}} + "dark" {"color" {"$type" "color" "$value" "#000000"}} + "$themes" [{"name" "Light" + "group" "" + "selectedTokenSets" {"light" "enabled" + "dark" "disabled"}}] + "$metadata" {"tokenSetOrder" ["light" "dark"]}} + lib (ctob/parse-decoded-json json "imported")] + (t/is (= #{"light"} (:sets (ctob/get-theme-by-name lib "" "Light")))))) + #?(:clj (t/deftest parse-multi-set-legacy-json (let [json (-> (slurp "test/common_tests/types/data/tokens-multi-set-legacy-example.json")