refactor: build tx-data in db-worker instead of the UI thread

So the tx-data will be built on top of the full db instead of the
partial db from the UI thread, it also reduces the risk to use
outdated data since RTC can transact data from the worker.
This commit is contained in:
Tienson Qin
2024-02-02 02:16:33 +08:00
parent 7a4251856a
commit 4e1ca386d4
13 changed files with 227 additions and 163 deletions

View File

@@ -8,6 +8,7 @@
[frontend.mobile.haptics :as haptics]
[logseq.outliner.core :as outliner-core]
[frontend.modules.outliner.ui :as ui-outliner-tx]
[frontend.modules.outliner.op :as outliner-op]
[frontend.state :as state]
[frontend.util :as util]
[frontend.util.drawer :as drawer]
@@ -334,12 +335,10 @@
{:outliner-op :move-blocks
:real-outliner-op :indent-outdent}
(when save-current-block (save-current-block))
(outliner-core/indent-outdent-blocks! (state/get-current-repo)
(db/get-db false)
(get-top-level-blocks blocks)
indent?
{:parent-original (get-first-block-original)
:logical-outdenting? (state/logical-outdenting?)})))))
(outliner-op/indent-outdent-blocks! (get-top-level-blocks blocks)
indent?
{:parent-original (get-first-block-original)
:logical-outdenting? (state/logical-outdenting?)})))))
(def *swipe (atom nil))