From 674c787f46d12d34c75d0abfe3ce5749163e2fa1 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Fri, 23 Feb 2024 18:12:47 +0800 Subject: [PATCH] perf: mark newly created blocks as fully loaded --- src/main/frontend/modules/outliner/pipeline.cljs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/frontend/modules/outliner/pipeline.cljs b/src/main/frontend/modules/outliner/pipeline.cljs index 70a4d6889..beea265e7 100644 --- a/src/main/frontend/modules/outliner/pipeline.cljs +++ b/src/main/frontend/modules/outliner/pipeline.cljs @@ -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))))