diff --git a/src/main/frontend/db.cljs b/src/main/frontend/db.cljs index 186129e65..deeee81db 100644 --- a/src/main/frontend/db.cljs +++ b/src/main/frontend/db.cljs @@ -155,8 +155,7 @@ (when logged? (d/transact! db-conn [(me-tx (d/db db-conn) me)])))] (restore-config-handler repo) - (listen-and-persist! repo) - (state/pub-event! [:after-db-restore repo]))))))) + (listen-and-persist! repo))))))) (defn run-batch-txs! [] diff --git a/src/main/frontend/handler.cljs b/src/main/frontend/handler.cljs index d5b7f0ad7..cfa8f194e 100644 --- a/src/main/frontend/handler.cljs +++ b/src/main/frontend/handler.cljs @@ -114,7 +114,8 @@ (js/console.error "Failed to request GitHub app tokens.")))) (watch-for-date!) - (file-handler/watch-for-local-dirs!))) + (file-handler/watch-for-local-dirs!) + (state/pub-event! [:after-db-restore repos]))) (p/catch (fn [error] (log/error :db/restore-failed error))))))] ;; clear this interval diff --git a/src/main/frontend/handler/events.cljs b/src/main/frontend/handler/events.cljs index 0fc7c6c9a..dd8d94d2f 100644 --- a/src/main/frontend/handler/events.cljs +++ b/src/main/frontend/handler/events.cljs @@ -98,18 +98,20 @@ -(defmethod handle :after-db-restore [[_ repo]] - ;; compare :ast/version - (let [db (conn/get-conn repo) - ast-version (:v (first (d/datoms db :aevt :ast/version)))] - (when (and (not= config/local-repo repo) - (or (nil? ast-version) - (. semver lt ast-version db-schema/ast-version))) - (notification/show! - [:p.content - (util/format "DB-schema updated, Please re-index repo [%s]" repo)] - :warning - false)))) +(defmethod handle :after-db-restore [[_ repos]] + (mapv (fn [{url :url} repo] + ;; compare :ast/version + (let [db (conn/get-conn url) + ast-version (:v (first (d/datoms db :aevt :ast/version)))] + (when (and (not= config/local-repo url) + (or (nil? ast-version) + (. semver lt ast-version db-schema/ast-version))) + (notification/show! + [:p.content + (util/format "DB-schema updated, Please re-index repo [%s]" url)] + :warning + false)))) + repos)) (defn run! []