diff --git a/src/main/frontend/handler/events.cljs b/src/main/frontend/handler/events.cljs index d2128ae689..c4386ad14b 100644 --- a/src/main/frontend/handler/events.cljs +++ b/src/main/frontend/handler/events.cljs @@ -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)] diff --git a/src/main/frontend/persist_db/browser.cljs b/src/main/frontend/persist_db/browser.cljs index 47621bb20d..7e17ba63de 100644 --- a/src/main/frontend/persist_db/browser.cljs +++ b/src/main/frontend/persist_db/browser.cljs @@ -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)) []))))) (