perf: mark newly created blocks as fully loaded

pull/11049/head
Tienson Qin 2024-02-23 18:12:47 +08:00
parent 61c953e134
commit 674c787f46
1 changed files with 7 additions and 1 deletions

View File

@ -54,7 +54,13 @@
(state/pub-event! [:init/commands])
(ui-handler/re-render-root!)))
(do
(let [tx-report (d/transact! conn tx-data tx-meta)]
(let [tx-data' (if (= (:outliner-op tx-meta) :insert-blocks)
(let [update-blocks-fully-loaded (keep (fn [datom] (when (= :block/uuid (:a datom))
{:db/id (:e datom)
:block.temp/fully-loaded? true})) tx-data)]
(concat update-blocks-fully-loaded tx-data))
tx-data)
tx-report (d/transact! conn tx-data' tx-meta)]
(when local-tx?
(let [tx-id (get-tx-id tx-report)]
(store-undo-data! (assoc opts :tx-id tx-id))))