Lazy load blocks in references and queries

This commit is contained in:
Tienson Qin
2022-05-10 13:11:43 +08:00
parent 3ca8228a74
commit 2614310ea8
8 changed files with 115 additions and 90 deletions

View File

@@ -3475,12 +3475,11 @@
1. References.
2. Custom queries."
[block config]
(if (or (:ref? config)
(:custom-query? config))
(and
(seq (:block/children block))
(or
(:custom-query? config)
(>= (:ref/level block)
(state/get-ref-open-blocks-level))))
(util/collapsed? block)))
(or
(and
(:ref? config)
(>= (inc (:block/level block))
(state/get-ref-open-blocks-level))
;; has children
(first (:block/_parent (db/entity (:db/id block)))))
(util/collapsed? block)))