fix: :current-page could be empty

pull/5435/head
Tienson Qin 2022-05-25 15:47:16 +08:00
parent b0349a8511
commit 1d1d8877b6
1 changed files with 5 additions and 2 deletions

View File

@ -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)