refactor: tree-seq version of get-block-refs-with-children

This commit is contained in:
Tienson Qin
2021-06-04 16:55:43 +08:00
parent 742210d25d
commit 42155bad7a

View File

@@ -30,14 +30,12 @@
(defn get-block-refs-with-children
[block]
(let [refs (atom [])]
(walk/postwalk
(fn [f]
(when (and (map? f) (:block/refs f))
(swap! refs concat (:block/refs f)))
f)
block)
(distinct @refs)))
(->>
(tree-seq :block/refs
:block/children
block)
(mapcat :block/refs)
(distinct)))
(defn filter-blocks
[repo ref-blocks filters group-by-page?]