add left+parent check after transact

pull/3275/head
rcmerci 2021-11-25 12:14:21 +08:00 committed by Tienson Qin
parent 7491857460
commit 4dfadfaaf9
1 changed files with 13 additions and 2 deletions

View File

@ -44,9 +44,20 @@
editor-cursor (state/get-current-edit-block-and-position)
meta (merge opts {:editor-cursor editor-cursor})
rs (d/transact! conn txs meta)]
(when true ; TODO: add debug flag
(let [eids (distinct (mapv first (:tx-data rs)))
left&parent-list (->>
(d/q '[:find ?e ?l ?p
:in $ [?e ...]
:where
[?e :block/left ?l]
[?e :block/parent ?p]] @conn eids)
(vec)
(map next))]
(assert (= (count left&parent-list) (count (distinct left&parent-list))) eids)))
(when-not config/test?
(after-transact-pipelines rs))
rs)
(after-transact-pipelines rs))
rs)
(catch js/Error e
(log/error :exception e)
(throw e))))))