瀏覽代碼

fix: set Timeout for detecting outdated filename foramt

Tienson Qin 2 年之前
父節點
當前提交
5f1d4aaeec
共有 2 個文件被更改,包括 9 次插入6 次删除
  1. 8 4
      src/main/frontend/handler/events.cljs
  2. 1 2
      src/main/frontend/state.cljs

+ 8 - 4
src/main/frontend/handler/events.cljs

@@ -363,10 +363,14 @@
         (state/pub-event! [:graph/dir-gone dir]))))
   ;; FIXME: an ugly implementation for redirecting to page on new window is restored
   (repo-handler/graph-ready! repo)
-  (when (and (util/electron?)
-             (not (config/demo-graph?))
-             (= :legacy (state/get-filename-format repo)))
-    (state/pub-event! [:ui/notify-outdated-filename-format []])))
+  (js/setTimeout
+   (fn []
+     (let [filename-format (state/get-filename-format repo)]
+       (when (and (util/electron?)
+                  (not (config/demo-graph?))
+                  (not= filename-format :triple-lowbar))
+         (state/pub-event! [:ui/notify-outdated-filename-format []]))))
+   3000))
 
 (defmethod handle :notification/show [[_ {:keys [content status clear?]}]]
   (notification/show! content status clear?))

+ 1 - 2
src/main/frontend/state.cljs

@@ -307,8 +307,7 @@
 (def default-config
   "Default config for a repo-specific, user config"
   {:feature/enable-search-remove-accents? true
-   :default-arweave-gateway "https://arweave.net"
-   :file/name-format :triple-lowbar})
+   :default-arweave-gateway "https://arweave.net"})
 
 ;; State that most user config is dependent on
 (declare get-current-repo sub set-state!)