Sfoglia il codice sorgente

fix: queries don't automatically update

Fix https://github.com/logseq/db-test/issues/237

This commit also updates custom queries to only fetch :db/id to
improve performance.
Tienson Qin 6 mesi fa
parent
commit
abf90fbb7d
2 ha cambiato i file con 3 aggiunte e 5 eliminazioni
  1. 1 4
      src/main/frontend/db/query_dsl.cljs
  2. 2 1
      src/main/frontend/db/react.cljs

+ 1 - 4
src/main/frontend/db/query_dsl.cljs

@@ -732,10 +732,7 @@ Some bindings in this fn:
 
 (def db-block-attrs
   "Block attributes for db graph queries"
-  ;; '*' needed as we need to pull user properties and don't know their names in advance
-  '[*
-    {:block/page [:db/id :block/name :block/title :block/journal-day]}
-    {:block/_parent ...}])
+  '[:db/id])
 
 (defn query
   "Runs a dsl query with query as a string. Primary use is from '/query' or '{{query }}'"

+ 2 - 1
src/main/frontend/db/react.cljs

@@ -198,7 +198,8 @@
            (when (or query query-fn)
              (try
                (let [f #(execute-query! repo-url db (vec (cons repo-url k)) cache)]
-                 (when-not custom?
+                 (if custom?
+                   (async/put! (state/get-reactive-custom-queries-chan) [f query])
                    (f)))
                (catch :default e
                  (js/console.error e)