Warning on multiple tab/windows access to the same graph

This commit is contained in:
Tienson Qin
2023-12-10 19:27:12 +08:00
parent 1977063ce3
commit 8a20b419d4
2 changed files with 13 additions and 2 deletions

View File

@@ -949,6 +949,14 @@
(defmethod handle :editor/edit-block [[_ block pos id opts]]
(editor-handler/edit-block! block pos id opts))
(defmethod handle :db/multiple-tabs-opfs-failed [_]
;; close current tab or window
(notification/show!
(let [word (if (util/electron?) "window" "tab")]
(util/format "Logseq doesn't support multiple %ss access to the same graph yet, please close this %s."
word word))
:warning false))
(defn run!
[]
(let [chan (state/get-events-chan)]

View File

@@ -9,7 +9,8 @@
[promesa.core :as p]
[frontend.util :as util]
[frontend.handler.notification :as notification]
[cljs-bean.core :as bean]))
[cljs-bean.core :as bean]
[frontend.state :as state]))
(defonce *sqlite (atom nil))
@@ -46,7 +47,9 @@
(bean/->clj result)))
(p/catch (fn [error]
(prn :debug :list-db-error (js/Date.))
(notification/show! [:div (str "SQLiteDB error: " error)] :error)
(if (= "NoModificationAllowedError" (.-name error))
(state/pub-event! [:db/multiple-tabs-opfs-failed])
(notification/show! [:div (str "SQLiteDB error: " error)] :error))
[])))))
(<unsafe-delete [_this repo]