Browse Source

fix: :current-page could be empty

Tienson Qin 3 năm trước cách đây
mục cha
commit
1d1d8877b6
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 5 2
      src/main/frontend/db/query_react.cljs

+ 5 - 2
src/main/frontend/db/query_react.cljs

@@ -12,6 +12,7 @@
             [frontend.state :as state]
             [logseq.graph-parser.text :as text]
             [frontend.util :as util]
+            [frontend.date :as date]
             [lambdaisland.glogi :as log]))
 
 (defn resolve-input
@@ -28,8 +29,10 @@
     (= :tomorrow input)
     (date->int (t/plus (t/today) (t/days 1)))
     (= :current-page input)
-    ;; This sometimes runs when there isn't a current page e.g. :home route
-    (some-> (state/get-current-page) string/lower-case)
+    (some-> (or (state/get-current-page)
+                (:page (state/get-default-home))
+                (date/today)) string/lower-case)
+
     (and (keyword? input)
          (util/safe-re-find #"^\d+d(-before)?$" (name input)))
     (let [input (name input)