fix: should only log query when debug is enabled

pull/6106/head
Peng Xiao 2022-07-20 11:36:56 +08:00 committed by Tienson Qin
parent 2b94a95f11
commit d271b85a51
2 changed files with 3 additions and 2 deletions

View File

@ -539,7 +539,6 @@ Some bindings in this fn:
result (if (coll? (first where))
(apply conj q where)
(conj q where))]
(prn "Datascript query: " result)
result))
(defn query

View File

@ -124,7 +124,8 @@
(defn react-query
[repo {:keys [query inputs rules] :as query'} query-opts]
(let [pprint (if config/dev? (fn [_] nil) debug/pprint)]
(let [pprint (if config/dev? debug/pprint (fn [_] nil))
start-time (.now js/performance)]
(pprint "================")
(pprint "Use the following to debug your datalog queries:")
(pprint query')
@ -137,4 +138,5 @@
k [:custom query']]
(pprint "inputs (post-resolution):" resolved-inputs)
(pprint "query-opts:" query-opts)
(pprint (str "time elapsed: " (.toFixed (- (.now js/performance) start-time) 2) "ms"))
(apply react/q repo k query-opts query inputs))))