fix: 'Replace graph' command not working

This commit is contained in:
Gabriel Horner
2026-03-05 18:38:31 -05:00
committed by rcmerci
parent 2864aab594
commit c73fdb8c6f
3 changed files with 13 additions and 1 deletions

View File

@@ -85,7 +85,7 @@
(defn import-chosen-graph
[repo]
(p/let [_ (persist-db/<unsafe-delete repo)]
(p/let [_ (persist-db/<close-db repo)]
(notification/show! (str "Graph updated! Switching to graph ...") :success)
(state/pub-event! [:graph/switch repo])))

View File

@@ -88,6 +88,13 @@
(protocol/<unsafe-delete client repo))
(protocol/<unsafe-delete (get-impl) repo))))
(defn <close-db [repo]
(when repo
(if (electron-runtime?)
(p/let [remote-client (<ensure-remote! repo)]
(remote/invoke! (:client remote-client) "thread-api/close-db" false [repo]))
(state/<invoke-db-worker :thread-api/close-db repo))))
(defn <export-db
[repo opts]
(when repo

View File

@@ -658,6 +658,11 @@
_result (remove-vfs! pool)]
nil))
(def-thread-api :thread-api/close-db
[repo]
(close-db! repo)
nil)
(defn- import-datoms-to-db!
[repo graph-id remote-tx datoms]
(->