mirror of https://github.com/logseq/logseq
fix: don't listen to unlink
Sometimes, the file watcher notify the `unlink` type when we edit a file using another editor ...pull/1274/head
parent
d55b381e2e
commit
7dcebf368b
|
@ -115,11 +115,11 @@
|
|||
:path (fix-win-path! path)
|
||||
:content (read-file path)
|
||||
:stat (fs/statSync path)})))
|
||||
(.on watcher "unlink"
|
||||
(fn [path]
|
||||
(send-file-watcher! win "unlink"
|
||||
{:dir (fix-win-path! dir)
|
||||
:path (fix-win-path! path)})))
|
||||
;; (.on watcher "unlink"
|
||||
;; (fn [path]
|
||||
;; (send-file-watcher! win "unlink"
|
||||
;; {:dir (fix-win-path! dir)
|
||||
;; :path (fix-win-path! path)})))
|
||||
(.on watcher "error"
|
||||
(fn [path]
|
||||
(println "Watch error happened: "
|
||||
|
|
|
@ -40,16 +40,16 @@
|
|||
|
||||
(file-handler/alter-file repo path content {:re-render-root? true})
|
||||
|
||||
(= "unlink" type)
|
||||
(when-let [page-name (db/get-file-page path)]
|
||||
(page-handler/delete!
|
||||
page-name
|
||||
(fn []
|
||||
(notification/show! (str "Page " page-name " was deleted on disk.")
|
||||
:success)
|
||||
(when (= (state/get-current-page) page-name)
|
||||
;; redirect to home
|
||||
(route-handler/redirect-to-home!)))))
|
||||
;; (= "unlink" type)
|
||||
;; (when-let [page-name (db/get-file-page path)]
|
||||
;; (page-handler/delete!
|
||||
;; page-name
|
||||
;; (fn []
|
||||
;; (notification/show! (str "Page " page-name " was deleted on disk.")
|
||||
;; :success)
|
||||
;; (when (= (state/get-current-page) page-name)
|
||||
;; ;; redirect to home
|
||||
;; (route-handler/redirect-to-home!)))))
|
||||
|
||||
(contains? #{"add" "change" "unlink"} type)
|
||||
nil
|
||||
|
|
Loading…
Reference in New Issue