From f1232fc4611eb4386153981b6c916fe8d416e109 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 6 Jun 2025 15:25:49 +0200 Subject: [PATCH] :bug: Fix issues with old profile theme data --- frontend/src/app/main/data/profile.cljs | 11 ++++++++++- frontend/src/app/main/ui/settings/options.cljs | 6 +++++- frontend/src/app/util/theme.cljs | 6 ++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/data/profile.cljs b/frontend/src/app/main/data/profile.cljs index 4a0fe03cb6..12d9d32a72 100644 --- a/frontend/src/app/main/data/profile.cljs +++ b/frontend/src/app/main/data/profile.cljs @@ -158,8 +158,17 @@ (update [_ state] (update-in state [:profile :theme] (fn [current] - (let [current (if (= current "system") + (let [current (cond + (= current "system") (theme/get-system-theme) + + ;; NOTE: this is a workaround for + ;; the old data on the database + ;; where whe have `default` value + (= current "default") + "dark" + + :else current)] (case current "dark" "light" diff --git a/frontend/src/app/main/ui/settings/options.cljs b/frontend/src/app/main/ui/settings/options.cljs index 5d3ff406e9..d855086816 100644 --- a/frontend/src/app/main/ui/settings/options.cljs +++ b/frontend/src/app/main/ui/settings/options.cljs @@ -37,7 +37,11 @@ [] (let [profile (mf/deref refs/profile) initial (mf/with-memo [profile] - (update profile :lang #(or % ""))) + (-> profile + (update :lang #(or % "")) + (update :theme #(if (= % "default") + "dark" + %)))) form (fm/use-form :schema schema:options-form :initial initial)] diff --git a/frontend/src/app/util/theme.cljs b/frontend/src/app/util/theme.cljs index 3c07f7ab68..e4c8db8bb7 100644 --- a/frontend/src/app/util/theme.cljs +++ b/frontend/src/app/util/theme.cljs @@ -44,5 +44,7 @@ (mf/with-effect [system-theme profile-theme] (set-color-scheme - (if (= profile-theme "system") system-theme - (d/nilv profile-theme "dark")))))) + (cond + (= profile-theme "system") system-theme + (= profile-theme "default") "dark" + :else (d/nilv profile-theme "dark"))))))