fix: notify graph dir is gone when starting or running the apps

Also, disabled both re-index and refresh when logseq detects that
a graph's dir doesn't exists anymore.
This commit is contained in:
Tienson Qin
2022-06-10 18:04:15 +08:00
parent 7d3a536bc8
commit b7ae3684be
11 changed files with 126 additions and 97 deletions

View File

@@ -55,22 +55,10 @@
(not (:encryption/graph-parsing? @state/state)))
(cond
(and (= "unlinkDir" type) dir)
(do
(state/pub-event! [:notification/show
{:content (str "The directory " dir " has been renamed or deleted, the editor will be disabled for this graph, you can unlink the graph.")
:status :error
:clear? false}])
(state/update-state! :file/unlinked-dirs (fn [dirs] (conj dirs dir))))
(state/pub-event! [:graph/dir-gone dir])
(= "addDir" type)
(when (contains? (:file/unlinked-dirs @state/state) dir)
(notification/clear-all!)
(state/pub-event! [:notification/show
{:content (str "The directory " dir " has been back, you can edit your graph now.")
:status :success
:clear? true}])
(fs/watch-dir! dir)
(state/update-state! :file/unlinked-dirs (fn [dirs] (disj dirs dir))))
(and (= "addDir" type) dir)
(state/pub-event! [:graph/dir-back repo dir])
(contains? (:file/unlinked-dirs @state/state) dir)
nil