fix: repos list

This commit is contained in:
Tienson Qin
2023-12-21 22:12:42 +08:00
parent 77a8ea13ab
commit 57c43c89e1
3 changed files with 8 additions and 34 deletions

View File

@@ -2,7 +2,6 @@
"Main ns that handles application startup. Closest ns that we have to a
system. Contains a couple of small system components"
(:require [cljs.reader :refer [read-string]]
[clojure.string :as string]
[electron.ipc :as ipc]
[electron.listener :as el]
[frontend.components.block :as block]
@@ -16,7 +15,6 @@
[frontend.db :as db]
[frontend.db.restore :as db-restore]
[frontend.db.conn :as conn]
[frontend.db.persist :as db-persist]
[frontend.db.react :as react]
[frontend.error :as error]
[frontend.handler.command-palette :as command-palette]
@@ -38,7 +36,6 @@
[frontend.modules.outliner.file :as file]
[frontend.modules.shortcut.core :as shortcut]
[frontend.state :as state]
[frontend.ui :as ui]
[frontend.util :as util]
[frontend.util.persist-var :as persist-var]
[goog.object :as gobj]
@@ -160,34 +157,6 @@
(js/window.location.reload)))
2000)))
;; FIXME: Another get-repos implementation at src\main\frontend\handler\repo.cljs
(defn- get-repos
[]
(->
(p/let [nfs-dbs (db-persist/get-all-graphs)]
;; TODO: Better IndexDB migration handling
(cond
(and (mobile-util/native-platform?)
(some #(or (string/includes? % " ")
(string/includes? % "logseq_local_/")) nfs-dbs))
(do (notification/show! ["DB version is not compatible, please clear cache then re-add your graph back."
(ui/button
(t :settings-page/clear-cache)
:class "ui__modal-enter"
:class "text-sm p-1"
:on-click clear-cache!)] :error false)
{:url config/local-repo
:example? true})
(seq nfs-dbs)
(map (fn [db] {:url db :nfs? true}) nfs-dbs)
:else
[{:url config/local-repo
:example? true}]))
(p/catch (fn [error]
(js/console.error error)))))
(defn- register-components-fns!
[]
(state/set-page-blocks-cp! page/page)
@@ -241,7 +210,7 @@
(when (mobile-util/native-platform?)
(mobile/mobile-preinit))
(-> (p/let [_ (db-browser/start-db-worker!)
repos (get-repos)
repos (repo-handler/get-repos)
_ (state/set-repos! repos)
_ (mobile-util/hide-splash) ;; hide splash as early as ui is stable
repo (or (state/get-current-repo) (:url (first repos)))