mirror of https://github.com/logseq/logseq
fix: don't run transact! macro if db requests are not finished yet
parent
9b344e12f7
commit
a3d5fc699d
|
@ -66,3 +66,5 @@
|
|||
(conn/start! repo option)))
|
||||
|
||||
(def new-block-id ldb/new-block-id)
|
||||
|
||||
(def request-finished? ldb/request-finished?)
|
||||
|
|
|
@ -17,11 +17,12 @@
|
|||
|
||||
(defmacro transact!
|
||||
[opts & body]
|
||||
`(let [transact-opts# {:repo (state/get-current-repo)
|
||||
:conn (db/get-db false)
|
||||
:unlinked-graph? frontend.modules.outliner.ui/unlinked-graph?
|
||||
:set-state-fn frontend.modules.outliner.ui/set-state-fn}]
|
||||
(when-not (:ui/before-editor-cursor @state/state)
|
||||
(state/set-state! :ui/before-editor-cursor (state/get-current-edit-block-and-position)))
|
||||
(logseq.outliner.transaction/transact! (assoc ~opts :transact-opts transact-opts#)
|
||||
~@body)))
|
||||
`(when (db/request-finished?)
|
||||
(let [transact-opts# {:repo (state/get-current-repo)
|
||||
:conn (db/get-db false)
|
||||
:unlinked-graph? frontend.modules.outliner.ui/unlinked-graph?
|
||||
:set-state-fn frontend.modules.outliner.ui/set-state-fn}]
|
||||
(when-not (:ui/before-editor-cursor @state/state)
|
||||
(state/set-state! :ui/before-editor-cursor (state/get-current-edit-block-and-position)))
|
||||
(logseq.outliner.transaction/transact! (assoc ~opts :transact-opts transact-opts#)
|
||||
~@body))))
|
||||
|
|
Loading…
Reference in New Issue