mirror of https://github.com/logseq/logseq
fix: blocks->vec-tree
parent
194f7b7a41
commit
0b38900d70
|
@ -2,7 +2,8 @@
|
||||||
"Provides tree fns and INode protocol"
|
"Provides tree fns and INode protocol"
|
||||||
(:require [logseq.db :as ldb]
|
(:require [logseq.db :as ldb]
|
||||||
[logseq.db.frontend.property.util :as db-property-util]
|
[logseq.db.frontend.property.util :as db-property-util]
|
||||||
[datascript.core :as d]))
|
[datascript.core :as d]
|
||||||
|
[datascript.impl.entity :as de]))
|
||||||
|
|
||||||
(defprotocol INode
|
(defprotocol INode
|
||||||
(-save [this txs-state conn repo date-formatter opts])
|
(-save [this txs-state conn repo date-formatter opts])
|
||||||
|
@ -50,7 +51,10 @@
|
||||||
(defn blocks->vec-tree
|
(defn blocks->vec-tree
|
||||||
"`blocks` need to be in the same page."
|
"`blocks` need to be in the same page."
|
||||||
[repo db blocks root-id]
|
[repo db blocks root-id]
|
||||||
(let [[page? root] (get-root-and-page db root-id)]
|
(let [blocks (map (fn [b] (if (de/entity? b)
|
||||||
|
(assoc (into {} b) :db/id (:db/id b))
|
||||||
|
b)) blocks)
|
||||||
|
[page? root] (get-root-and-page db root-id)]
|
||||||
(if-not root ; custom query
|
(if-not root ; custom query
|
||||||
blocks
|
blocks
|
||||||
(let [result (blocks->vec-tree-aux repo db blocks root)]
|
(let [result (blocks->vec-tree-aux repo db blocks root)]
|
||||||
|
|
Loading…
Reference in New Issue