浏览代码

enhance: today's journal should be displayed quickly for new graph

Tienson Qin 4 年之前
父节点
当前提交
724cfc2b58
共有 3 个文件被更改,包括 11 次插入9 次删除
  1. 3 1
      src/main/frontend/handler/events.cljs
  2. 2 1
      src/main/frontend/handler/page.cljs
  3. 6 7
      src/main/frontend/handler/repo.cljs

+ 3 - 1
src/main/frontend/handler/events.cljs

@@ -19,6 +19,7 @@
             [frontend.handler.editor :as editor-handler]
             [frontend.handler.notification :as notification]
             [frontend.handler.page :as page-handler]
+            [frontend.handler.ui :as ui-handler]
             [frontend.spec :as spec]
             [frontend.state :as state]
             [frontend.ui :as ui]
@@ -163,7 +164,8 @@
   (page-handler/rename! old-title new-title))
 
 (defmethod handle :page/create-today-journal [[_ repo]]
-  (page-handler/create-today-journal!))
+  (p/let [_ (page-handler/create-today-journal!)]
+    (ui-handler/re-render-root!)))
 
 (defmethod handle :file/not-matched-from-disk [[_ path disk-content db-content]]
   (state/clear-edit!)

+ 2 - 1
src/main/frontend/handler/page.cljs

@@ -378,7 +378,8 @@
 
         (unfavorite-page! page-name)
 
-        (ok-handler)))))
+        (ok-handler)
+        (ui-handler/re-render-root!)))))
 
 (defn- rename-page-aux [old-name new-name]
   (when-let [repo (state/get-current-repo)]

+ 6 - 7
src/main/frontend/handler/repo.cljs

@@ -154,13 +154,12 @@
    (let [repo-dir (config/get-repo-dir repo-url)]
      (p/let [_ (fs/mkdir-if-not-exists (str repo-dir "/" config/app-name))
              _ (fs/mkdir-if-not-exists (str repo-dir "/" config/app-name "/" config/recycle-dir))
-             _ (fs/mkdir-if-not-exists (str repo-dir "/" (config/get-journals-directory)))]
-       (file-handler/create-metadata-file repo-url encrypted?)
-       ;; TODO: move to frontend.handler.file
-       (create-config-file-if-not-exists repo-url)
-       (create-contents-file repo-url)
-       (create-favorites-file repo-url)
-       (create-custom-theme repo-url)
+             _ (fs/mkdir-if-not-exists (str repo-dir "/" (config/get-journals-directory)))
+             _ (file-handler/create-metadata-file repo-url encrypted?)
+             _ (create-config-file-if-not-exists repo-url)
+             _ (create-contents-file repo-url)
+             _ (create-favorites-file repo-url)
+             _ (create-custom-theme repo-url)]
        (state/pub-event! [:page/create-today-journal repo-url])))))
 
 (defn- remove-non-exists-refs!