mirror of https://github.com/logseq/logseq
fix: query result display
parent
9028976100
commit
b8b0107123
|
@ -3151,7 +3151,7 @@
|
|||
*navigating-block (get state ::navigating-block)
|
||||
navigating-block (rum/react *navigating-block)
|
||||
navigated? (and (not= (:block/uuid block) navigating-block) navigating-block)
|
||||
_ (state/sub-async-query-loading (:block/uuid block))]
|
||||
_ (when (:block/uuid block) (state/sub-async-query-loading (:block/uuid block)))]
|
||||
(when (:block/uuid block)
|
||||
(let [[original-block block] (build-block config block {:navigating-block navigating-block :navigated? navigated?})
|
||||
config' (if original-block
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
"Async util helper"
|
||||
(:require [frontend.state :as state]
|
||||
[promesa.core :as p]
|
||||
[clojure.edn :as edn]))
|
||||
[clojure.edn :as edn]
|
||||
[frontend.db.conn :as db-conn]
|
||||
[datascript.core :as d]))
|
||||
|
||||
(defn <q
|
||||
[graph & inputs]
|
||||
|
@ -10,7 +12,16 @@
|
|||
(when-let [^Object sqlite @state/*db-worker]
|
||||
(p/let [result (.q sqlite graph (pr-str inputs))]
|
||||
(when result
|
||||
(edn/read-string result)))))
|
||||
(let [result' (edn/read-string result)]
|
||||
(when (seq result')
|
||||
(when-let [conn (db-conn/get-db graph false)]
|
||||
(let [tx-data (if (and (coll? result')
|
||||
(coll? (first result'))
|
||||
(not (map? (first result'))))
|
||||
(apply concat result')
|
||||
result')]
|
||||
(d/transact! conn tx-data))))
|
||||
result')))))
|
||||
|
||||
(defn <pull
|
||||
([graph id]
|
||||
|
@ -19,7 +30,10 @@
|
|||
(when-let [^Object sqlite @state/*db-worker]
|
||||
(p/let [result (.pull sqlite graph (pr-str selector) (pr-str id))]
|
||||
(when result
|
||||
(edn/read-string result))))))
|
||||
(let [result' (edn/read-string result)]
|
||||
(when-let [conn (db-conn/get-db graph false)]
|
||||
(d/transact! conn [result']))
|
||||
result'))))))
|
||||
|
||||
(comment
|
||||
(defn <pull-many
|
||||
|
|
Loading…
Reference in New Issue