enhance: notify db saved only for manual triggers

experiment/tanstack-table
Tienson Qin 2024-06-15 00:03:39 +08:00
parent 4cca2e5f69
commit e0fafe4725
2 changed files with 6 additions and 5 deletions

View File

@ -844,7 +844,7 @@
:label "graph-setup"}))
(defmethod handle :graph/save-db-to-disk [[_ _opts]]
(persist-db/export-current-graph!))
(persist-db/export-current-graph! {:succ-notification? true}))
(defmethod handle :search/transact-data [[_ repo data]]
(let [file-based? (config/local-file-based-graph? repo)

View File

@ -42,7 +42,7 @@
(<export-db repo {})))
(defn export-current-graph!
[]
[& {:keys [succ-notification?]}]
(when (util/electron?)
(when-let [repo (state/get-current-repo)]
(when (config/db-based-graph? repo)
@ -50,9 +50,10 @@
(->
(p/do!
(<export-db repo {})
(state/pub-event!
[:notification/show {:content "The current db has been saved successfully to the disk."
:status :success}]))
(when succ-notification?
(state/pub-event!
[:notification/show {:content "The current db has been saved successfully to the disk."
:status :success}])))
(p/catch (fn [^js error]
(js/console.error error)
(state/pub-event!