fix: config cleared if passed content is nil

Fixed #6701
Fixed #6700
pull/6705/head
Tienson Qin 2022-09-13 18:12:34 +08:00 committed by Andelf
parent 6d918c694e
commit 9b34aec950
4 changed files with 8 additions and 7 deletions

View File

@ -121,7 +121,7 @@
(fn [_]
(cond
(= path (config/get-repo-config-path repo))
(p/let [_ (repo-config-handler/restore-repo-config! repo)]
(p/let [_ (repo-config-handler/restore-repo-config! repo content)]
(state/pub-event! [:shortcut/refresh]))
(and (config/global-config-enabled?) (= path (global-config-handler/global-config-path)))

View File

@ -51,9 +51,10 @@
(defn restore-repo-config!
"Sets repo config state from db"
[repo-url]
(let [config-content (get-repo-config-content repo-url)]
(set-repo-config-state! repo-url config-content)))
([repo-url]
(restore-repo-config! repo-url (get-repo-config-content repo-url)))
([repo-url config-content]
(set-repo-config-state! repo-url config-content)))
(defn start
"This component only has one reponsibility on start, to manage db and ui state

View File

@ -1311,12 +1311,12 @@ Similar to re-frame subscriptions"
(defn set-config!
[repo-url value]
(set-state! [:config repo-url] value))
(when value (set-state! [:config repo-url] value)))
(defn set-global-config!
[value]
;; Placed under :config so cursors can work seamlessly
(set-config! ::global-config value))
(when value (set-config! ::global-config value)))
(defn get-wide-mode?
[]

View File

@ -213,7 +213,7 @@
:ref/linked-references-collapsed-threshold 50
:favorites ["How to take dummy notes?"]
:favorites []
;; any number between 0 and 1 (the greater it is the faster the changes of the next-interval of card reviews) (default 0.5)
;; :srs/learning-fraction 0.5