fix: revert :block/children because it doesn't work

We need to resolve those tempids after db transacted which makes it slow
This commit is contained in:
Tienson Qin
2020-11-12 23:55:35 +08:00
parent abfb3dc12e
commit 5987cc9742
3 changed files with 30 additions and 32 deletions

View File

@@ -272,23 +272,23 @@
(when (util/uuid-string? custom-id)
(uuid custom-id))))
(d/squuid))
temp-id (d/tempid :db.part/user)
block (second block)
level (:level block)
[children current-block-children]
(cond
(>= level last-level)
[(conj children [temp-id level])
[(conj children [id level])
#{}]
(< level last-level)
(let [current-block-children (set (->> (filter #(< level (second %)) children)
(map first)))
(map first)
(map (fn [id]
[:block/uuid id]))))
others (vec (remove #(< level (second %)) children))]
[(conj others [temp-id level])
[(conj others [id level])
current-block-children]))
block (-> (assoc block
:db/id temp-id
:uuid id
:body (vec (reverse block-body))
:properties (:properties properties)