fix: empty transact to notify batch-tx exit

pull/11293/head
rcmerci 2024-04-19 18:08:29 +08:00
parent bffd1b5c8e
commit 03246325b3
2 changed files with 5 additions and 5 deletions

View File

@ -13,4 +13,5 @@
~@body
(when (seq ~additional-tx)
(logseq.db/transact! ~conn ~additional-tx {}))
(datascript.core/transact! ~conn [] {:batch-tx/exit? true})
(frontend.worker.batch-tx/exit-batch-txs-mode!))))

View File

@ -68,10 +68,9 @@
(d/unlisten! conn ::listen-db-changes!)
(d/listen! conn ::listen-db-changes!
(fn [{:keys [tx-data _db-before _db-after tx-meta] :as tx-report}]
(let [pipeline-replace? (:pipeline-replace? tx-meta)
batch-processing? (some? (batch-tx/get-batch-db-before))]
(let [pipeline-replace? (:pipeline-replace? tx-meta)]
(when-not pipeline-replace?
(if batch-processing?
(if-not (:batch-tx/exit? tx-meta)
(batch-tx/conj-batch-txs! tx-data)
(let [;; exiting-batch-mode? (> (:batch-tx/counter (d/entity db-before :logseq.kv/tx-batch-counter)) 0)
db-before (batch-tx/get-batch-db-before)
@ -79,9 +78,9 @@
;; (:db-before tx-report))
tx-data (batch-tx/get-batch-txs);; (if exiting-batch-mode?
tx-data (batch-tx/get-batch-txs) ;; (if exiting-batch-mode?
;; (concat (:tx-data tx-report) tx-data))
;; (concat (:tx-data tx-report) tx-data))
tx-report (assoc tx-report
:db-before db-before
:tx-data tx-data)