mirror of https://github.com/logseq/logseq
fix: graph unlink is not executed on all the windows
parent
96b9ccb457
commit
94a401140c
|
@ -319,6 +319,10 @@
|
|||
(defmethod handle :quitAndInstall []
|
||||
(.quitAndInstall autoUpdater))
|
||||
|
||||
(defmethod handle :graphUnlinked [^js win [_ repo]]
|
||||
(doseq [window (win/get-all-windows)]
|
||||
(utils/send-to-renderer window "graphUnlinked" (bean/->clj repo))))
|
||||
|
||||
(defmethod handle :default [args]
|
||||
(println "Error: no ipc handler for: " (bean/->js args)))
|
||||
|
||||
|
|
|
@ -77,7 +77,9 @@
|
|||
(.getFocusedWindow BrowserWindow))
|
||||
|
||||
(defn send-to-renderer
|
||||
[kind payload]
|
||||
(when-let [window (get-focused-window)]
|
||||
(.. ^js window -webContents
|
||||
(send kind (bean/->js payload)))))
|
||||
([kind payload]
|
||||
(send-to-renderer (get-focused-window) kind payload))
|
||||
([window kind payload]
|
||||
(when window
|
||||
(.. ^js window -webContents
|
||||
(send kind (bean/->js payload))))))
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
[electron.ipc :as ipc]
|
||||
[frontend.handler.notification :as notification]
|
||||
[frontend.handler.metadata :as metadata-handler]
|
||||
[frontend.handler.repo :as repo-handler]
|
||||
[frontend.ui :as ui]
|
||||
[frontend.db.persist :as db-persist]))
|
||||
|
||||
|
@ -59,6 +60,11 @@
|
|||
comp [:div (str payload)]]
|
||||
(notification/show! comp type false))))
|
||||
|
||||
(js/window.apis.on "graphUnlinked"
|
||||
(fn [data]
|
||||
(let [repo (bean/->clj data)]
|
||||
(repo-handler/remove-repo! repo))))
|
||||
|
||||
(js/window.apis.on "setGitUsernameAndEmail"
|
||||
(fn []
|
||||
(state/pub-event! [:modal/set-git-username-and-email])))
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
[shadow.resource :as rc]
|
||||
[clojure.set :as set]
|
||||
[frontend.mobile.util :as mobile]
|
||||
[frontend.db.persist :as db-persist]))
|
||||
[frontend.db.persist :as db-persist]
|
||||
[electron.ipc :as ipc]))
|
||||
|
||||
;; Project settings should be checked in two situations:
|
||||
;; 1. User changes the config.edn directly in logseq.com (fn: alter-file)
|
||||
|
@ -537,10 +538,12 @@
|
|||
[{:keys [id url] :as repo}]
|
||||
;; (spec/validate :repos/repo repo)
|
||||
(let [delete-db-f (fn []
|
||||
(db/remove-conn! url)
|
||||
(db-persist/delete-graph! url)
|
||||
(search/remove-db! url)
|
||||
(state/delete-repo! repo))]
|
||||
(let [graph-exists? (db/get-conn url)]
|
||||
(db/remove-conn! url)
|
||||
(db-persist/delete-graph! url)
|
||||
(search/remove-db! url)
|
||||
(state/delete-repo! repo)
|
||||
(when graph-exists? (ipc/ipc "graphUnlinked" repo))))]
|
||||
(if (or (config/local-db? url) (= url "local"))
|
||||
(p/let [_ (idb/clear-local-db! url)] ; clear file handles
|
||||
(delete-db-f))
|
||||
|
|
Loading…
Reference in New Issue