Fix: broken linked references (#6105)

* enhance: clicking the refresh button if a query is slow

* fix: skip running slow queries if there's no need to refresh

* fix: linked reference filtering does not work on TASK items

close #1669

* fix: each block should have its own page as a reference when query page references

* fix: references

* fix: non consecutive blocks in query result and filtered linked references

* simplify filters logic

* fix: ref numbers

* Save both :block/refs and :block/path-refs for different usage

* fix: block refs

* enhance: move scheduled and deadlines to its own ns

* linked references performance tweaks

* mouse hover filters icon to expand the collapsed linked refs

* perf: react/refresh! once instead twice

* enhance: compute flashcards every hour instead of every 5s

* feat: macros as blocks

* feat: flashcards list

* fix: refed pages count

* fix: can't select in linked references

* fix: block editing on linked refs

* perf: editing in linked references

* enhance: update srs cards number when clicking flashcards

* Add a test for the case fixed in #6100

* Address feedbacks from Gabriel

* fix: Block Ref Indicator is missing from the references-blocks class

close #5375

* fix: referenced pages

* fix: page refs

* fix: Using filters pushed the title property to the second block

close #5845

Co-authored-by: Gabriel Horner <gabriel@logseq.com>
This commit is contained in:
Tienson Qin
2022-08-04 13:03:12 +08:00
committed by GitHub
parent 0694154829
commit a1ca6820df
47 changed files with 1184 additions and 933 deletions

View File

@@ -528,18 +528,18 @@ Some bindings in this fn:
;; ========
(defn query-wrapper
[where blocks?]
(let [q (if blocks? ; FIXME: it doesn't need to be either blocks or pages
`[:find (~'pull ~'?b ~model/block-attrs)
[where {:keys [blocks? block-attrs]}]
(let [block-attrs (or block-attrs (butlast model/block-attrs))
q (if blocks? ; FIXME: it doesn't need to be either blocks or pages
`[:find (~'pull ~'?b ~block-attrs)
:in ~'$ ~'%
:where]
'[:find (pull ?p [*])
:in $ %
:where])
result (if (coll? (first where))
(apply conj q where)
(conj q where))]
result))
:where])]
(if (coll? (first where))
(apply conj q where)
(conj q where))))
(defn query
"Runs a dsl query with query as a string. Primary use is from '{{query }}'"
@@ -547,7 +547,7 @@ Some bindings in this fn:
(when (and (string? query-string) (not= "\"\"" query-string))
(let [query-string' (template/resolve-dynamic-template! query-string)
{:keys [query rules sort-by blocks? sample]} (parse query-string')]
(when-let [query' (some-> query (query-wrapper blocks?))]
(when-let [query' (some-> query (query-wrapper {:blocks? blocks?}))]
(let [sort-by (or sort-by identity)
random-samples (if @sample
(fn [col]
@@ -567,7 +567,7 @@ Some bindings in this fn:
(when (seq (:query query-m))
(let [query-string (template/resolve-dynamic-template! (pr-str (:query query-m)))
{:keys [query sort-by blocks? rules]} (parse query-string)]
(when-let [query' (some-> query (query-wrapper blocks?))]
(when-let [query' (some-> query (query-wrapper {:blocks? blocks?}))]
(query-react/react-query repo
(merge
query-m