From c75ab61732e6a888d08511fd8703367eb12f87f2 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Mon, 30 Sep 2024 14:44:42 +0200 Subject: [PATCH] Fix renamed theme staying in active-themes --- common/src/app/common/types/tokens_lib.cljc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/common/src/app/common/types/tokens_lib.cljc b/common/src/app/common/types/tokens_lib.cljc index b14951059..88eb76c72 100644 --- a/common/src/app/common/types/tokens_lib.cljc +++ b/common/src/app/common/types/tokens_lib.cljc @@ -487,16 +487,21 @@ (let [theme' (-> (make-token-theme (f theme)) (assoc :modified-at (dt/now))) group' (:group theme') - name' (:name theme')] + name' (:name theme') + same-group? (= group group') + same-name? (= name name') + same-path? (and same-group? same-name?)] (check-token-theme! theme') (TokensLib. sets set-groups - (if (and (= group group') (= name name')) + (if same-path? (update themes group' assoc name' theme') (-> themes (d/oassoc-in-before [group name] [group' name'] theme') (d/dissoc-in [group name]))) - active-themes)) + (if same-path? + active-themes + (disj active-themes (token-theme-path group name))))) this))) (delete-theme [_ group name]