Pārlūkot izejas kodu

perf: mark newly created blocks as fully loaded

Tienson Qin 1 gadu atpakaļ
vecāks
revīzija
674c787f46
1 mainītis faili ar 7 papildinājumiem un 1 dzēšanām
  1. 7 1
      src/main/frontend/modules/outliner/pipeline.cljs

+ 7 - 1
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))))