浏览代码

enhance: catch errors when app quits

Tienson Qin 4 年之前
父节点
当前提交
b96332122f

+ 4 - 1
src/electron/electron/core.cljs

@@ -244,7 +244,10 @@
                (.focus win))))
 
       (.on app "window-all-closed" (fn []
-                                     (search/close!)
+                                     (try
+                                       (search/close!)
+                                       (catch js/Error _e
+                                         nil))
                                      (.quit app)))
       (.on app "ready"
            (fn []

+ 1 - 1
src/electron/electron/git.cljs

@@ -73,7 +73,7 @@
   []
   (-> (run-git! #js ["add" "./*"])
       (p/catch (fn [error]
-                 (if (string/includes? "permission denied error: unable to index file")
+                 (if (string/includes? error "permission denied error: unable to index file")
                    (js/console.error error)
                    (p/rejected error))))))
 

+ 0 - 8
src/main/frontend/components/repo.cljs

@@ -75,14 +75,6 @@
                                :on-click (fn []
                                            (state/set-modal! (encryption/encryption-dialog url)))}
                    "🔐"])
-                [:a.control.ml-4 {:title (if local?
-                                           "Sync with the local directory"
-                                           "Clone again and re-index the db")
-                                  :on-click (fn []
-                                              (repo-handler/re-index!
-                                               nfs-handler/rebuild-index!
-                                               page-handler/create-today-journal!))}
-                 "Re-index"]
                 [:a.text-gray-400.ml-4 {:title "No worries, unlink this graph will clear its cache only, it does not remove your files on the disk."
                                         :on-click (fn []
                                                     (repo-handler/remove-repo! repo))}

+ 0 - 6
src/main/frontend/modules/shortcut/config.cljs

@@ -301,12 +301,6 @@
     {:desc    "Rebuild search index"
      :binding "mod+c mod+s"
      :fn      search-handler/rebuild-indices!}
-    :graph/re-index
-    {:desc    "Re-index the whole graph"
-     :binding "mod+c mod+r"
-     :fn      #(repo-handler/re-index!
-                nfs-handler/rebuild-index!
-                page-handler/create-today-journal!)}
     :sidebar/open-today-page
     {:desc    "Open today's page in the right sidebar"
      :binding (if mac? "mod+shift+j" "alt+shift+j")