Selaa lähdekoodia

Apple feedback to query_react

Ben 3 vuotta sitten
vanhempi
sitoutus
657d83e4ae
1 muutettua tiedostoa jossa 10 lisäystä ja 7 poistoa
  1. 10 7
      src/main/frontend/db/query_react.cljs

+ 10 - 7
src/main/frontend/db/query_react.cljs

@@ -34,28 +34,31 @@
      (some-> (or (state/get-current-page)
      (some-> (or (state/get-current-page)
                  (:page (state/get-default-home))
                  (:page (state/get-default-home))
                  (date/today)) string/lower-case)
                  (date/today)) string/lower-case)
-     (= :current-block input)
+     (and current-block-uuid (= :current-block input))
      (:db/id (db-utils/entity [:block/uuid current-block-uuid]))
      (:db/id (db-utils/entity [:block/uuid current-block-uuid]))
-     (= :parent-block input)
+     (and current-block-uuid (= :parent-block input))
      (:db/id (model/get-block-parent current-block-uuid))
      (:db/id (model/get-block-parent current-block-uuid))
-
+     ;; :3d-before-ms
      (and (keyword? input)
      (and (keyword? input)
-          (util/safe-re-find #"^\d+d(-before-ms)?$" (name input)))
+          (re-find #"^\d+d(-before-ms)?$" (name input)))
      (let [input (name input)
      (let [input (name input)
            days (parse-long (re-find #"^\d+" input))]
            days (parse-long (re-find #"^\d+" input))]
        (util/date-at-local-ms (t/minus (t/today) (t/days days)) 0 0 0 0))
        (util/date-at-local-ms (t/minus (t/today) (t/days days)) 0 0 0 0))
+     ;; :3d-after-ms
      (and (keyword? input)
      (and (keyword? input)
-          (util/safe-re-find #"^\d+d(-after-ms)?$" (name input)))
+          (re-find #"^\d+d(-after-ms)?$" (name input)))
      (let [input (name input)
      (let [input (name input)
            days (parse-long (re-find #"^\d+" input))]
            days (parse-long (re-find #"^\d+" input))]
        (util/date-at-local-ms (t/plus (t/today) (t/days days)) 24 0 0 0))
        (util/date-at-local-ms (t/plus (t/today) (t/days days)) 24 0 0 0))
+     ;; :3d-before
      (and (keyword? input)
      (and (keyword? input)
-          (util/safe-re-find #"^\d+d(-before)?$" (name input)))
+          (re-find #"^\d+d(-before)?$" (name input)))
      (let [input (name input)
      (let [input (name input)
            days (parse-long (re-find #"^\d+" input))]
            days (parse-long (re-find #"^\d+" input))]
        (date->int (t/minus (t/today) (t/days days))))
        (date->int (t/minus (t/today) (t/days days))))
+     ;; :3d-after
      (and (keyword? input)
      (and (keyword? input)
-          (util/safe-re-find #"^\d+d(-after)?$" (name input)))
+          (re-find #"^\d+d(-after)?$" (name input)))
      (let [input (name input)
      (let [input (name input)
            days (parse-long (re-find #"^\d+" input))]
            days (parse-long (re-find #"^\d+" input))]
        (date->int (t/plus (t/today) (t/days days))))
        (date->int (t/plus (t/today) (t/days days))))