🐛 Fix issues with old profile theme data

This commit is contained in:
Andrey Antukh 2025-06-06 15:25:49 +02:00
parent 9584e1b02d
commit f1232fc461
3 changed files with 19 additions and 4 deletions

View File

@ -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"

View File

@ -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)]

View File

@ -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"))))))