Przeglądaj źródła

fix: lint warning

Tienson Qin 3 lat temu
rodzic
commit
dda618ca8f
1 zmienionych plików z 11 dodań i 15 usunięć
  1. 11 15
      src/main/frontend/components/file_sync.cljs

+ 11 - 15
src/main/frontend/components/file_sync.cljs

@@ -24,7 +24,6 @@
             [frontend.util :as util]
             [frontend.util.fs :as fs-util]
             [frontend.storage :as storage]
-            [logseq.graph-parser.config :as gp-config]
             [promesa.core :as p]
             [reitit.frontend.easy :as rfe]
             [rum.core :as rum]
@@ -481,20 +480,17 @@
 
              (when (seq history-files)
                (map-indexed (fn [i f] (:time f)
-                              (let [path        (:path f)
-                                    ext         (util/get-file-ext path)]
-                                (when ext
-                                  (let [ext         (string/lower-case ext)
-                                        full-path   (util/node-path.join (config/get-repo-dir current-repo) path)
-                                        page-name   (db/get-file-page full-path)]
-                                    {:title [:div.files-history.cursor-pointer
-                                             {:key      i :class (when (= i 0) "is-first")
-                                              :on-click (fn []
-                                                          (if page-name
-                                                            (rfe/push-state :page {:name page-name})
-                                                            (rfe/push-state :file {:path full-path})))}
-                                             [:span.file-sync-item (js/decodeURIComponent (:path f))]
-                                             [:div.opacity-50 (ui/humanity-time-ago (:time f) nil)]]}))))
+                              (when-let [path (:path f)]
+                                (let [full-path   (util/node-path.join (config/get-repo-dir current-repo) path)
+                                      page-name   (db/get-file-page full-path)]
+                                  {:title [:div.files-history.cursor-pointer
+                                           {:key      i :class (when (= i 0) "is-first")
+                                            :on-click (fn []
+                                                        (if page-name
+                                                          (rfe/push-state :page {:name page-name})
+                                                          (rfe/push-state :file {:path full-path})))}
+                                           [:span.file-sync-item (js/decodeURIComponent (:path f))]
+                                           [:div.opacity-50 (ui/humanity-time-ago (:time f) nil)]]})))
                             (take 10 history-files)))))
 
           ;; options