diff --git a/src/main/frontend/components/views.cljs b/src/main/frontend/components/views.cljs index ee588899be6..913f3c306ec 100644 --- a/src/main/frontend/components/views.cljs +++ b/src/main/frontend/components/views.cljs @@ -6,6 +6,7 @@ [clojure.set :as set] [clojure.string :as string] [datascript.impl.entity :as de] + [datascript.core :as d] [frontend.components.dnd :as dnd] [frontend.components.property.value :as pv] [frontend.components.select :as select] @@ -28,9 +29,12 @@ (defn- get-latest-entity [e] - (assoc (db/entity (:db/id e)) - :id (:id e) - :block.temp/refs-count (:block.temp/refs-count e))) + (let [transacted-ids (:updated-ids @(:db/latest-transacted-entity-uuids @state/state))] + (if (and transacted-ids (contains? transacted-ids (:block/uuid e))) + (assoc (db/entity (:db/id e)) + :id (:id e) + :block.temp/refs-count (:block.temp/refs-count e)) + e))) (rum/defc header-checkbox < rum/static [{:keys [selected-all? selected-some? toggle-selected-all!]}] diff --git a/src/main/frontend/modules/outliner/pipeline.cljs b/src/main/frontend/modules/outliner/pipeline.cljs index 868d59b55ca..050ae3f7132 100644 --- a/src/main/frontend/modules/outliner/pipeline.cljs +++ b/src/main/frontend/modules/outliner/pipeline.cljs @@ -35,6 +35,9 @@ :else (do + (state/set-state! :db/latest-updated-entity-uuids + {:updated-ids (set (map :block/uuid blocks)) + :deleted-ids (set deleted-block-uuids)}) (let [tx-data' (concat (map (fn [id] diff --git a/src/main/frontend/state.cljs b/src/main/frontend/state.cljs index 4026988237f..d0d26d48047 100644 --- a/src/main/frontend/state.cljs +++ b/src/main/frontend/state.cljs @@ -319,7 +319,8 @@ :ui/select-query-cache (atom {}) :favorites/updated? (atom 0) :db/async-query-loading (atom #{}) - :db/async-queries (atom {})}))) + :db/async-queries (atom {}) + :db/latest-transacted-entity-uuids (atom {})}))) ;; Block ast state ;; ===============