mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
fix: unlink wrong graphs
This commit is contained in:
@@ -85,10 +85,11 @@
|
||||
(file-sync/load-session-graphs)
|
||||
(state/set-state! [:ui/loading? :remove/remote-graph GraphUUID] false)))}))]
|
||||
(state/set-modal! (confirm-fn)))
|
||||
(do
|
||||
(let [current-repo (state/get-current-repo)]
|
||||
(repo-handler/remove-repo! repo)
|
||||
(file-sync/load-session-graphs)
|
||||
(state/pub-event! [:graph/unlinked]))))}
|
||||
(state/pub-event! [:graph/unlinked repo current-repo])
|
||||
(when only-cloud?
|
||||
(file-sync/load-session-graphs)))))}
|
||||
(if only-cloud? "Remove" "Unlink")])])]]))
|
||||
|
||||
(rum/defc repos < rum/reactive
|
||||
|
||||
@@ -116,9 +116,9 @@
|
||||
(repo-handler/refresh-repos!)
|
||||
(file-sync-restart!))
|
||||
|
||||
(defmethod handle :graph/unlinked [_]
|
||||
(repo-handler/refresh-repos!)
|
||||
(file-sync-restart!))
|
||||
(defmethod handle :graph/unlinked [repo current-repo]
|
||||
(when (= (:url repo) current-repo)
|
||||
(file-sync-restart!)))
|
||||
|
||||
(defmethod handle :graph/refresh [_]
|
||||
(repo-handler/refresh-repos!))
|
||||
|
||||
@@ -341,13 +341,14 @@
|
||||
(defn remove-repo!
|
||||
[{:keys [url] :as repo}]
|
||||
(let [delete-db-f (fn []
|
||||
(let [graph-exists? (db/get-db url)]
|
||||
(let [graph-exists? (db/get-db url)
|
||||
current-repo (state/get-current-repo)]
|
||||
(db/remove-conn! url)
|
||||
(db-persist/delete-graph! url)
|
||||
(search/remove-db! url)
|
||||
(state/delete-repo! repo)
|
||||
(when graph-exists? (ipc/ipc "graphUnlinked" repo))
|
||||
(when (= (state/get-current-repo) url)
|
||||
(when (= current-repo url)
|
||||
(state/set-current-repo! (:url (first (state/get-repos)))))))]
|
||||
(when (or (config/local-db? url) (= url "local"))
|
||||
(-> (p/let [_ (idb/clear-local-db! url)] ; clear file handles
|
||||
|
||||
@@ -762,7 +762,10 @@ Similar to re-frame subscriptions"
|
||||
(swap! state update-in [:me :repos]
|
||||
(fn [repos]
|
||||
(->> (remove #(or (= (:url repo) (:url %))
|
||||
(= (:GraphUUID repo) (:GraphUUID %))) repos)
|
||||
(and
|
||||
(:GraphUUID repo)
|
||||
(:GraphUUID %)
|
||||
(= (:GraphUUID repo) (:GraphUUID %)))) repos)
|
||||
(util/distinct-by :url)))))
|
||||
|
||||
(defn set-timestamp-block!
|
||||
|
||||
Reference in New Issue
Block a user