diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index 6cafca035e..4b26970f72 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -2078,16 +2078,7 @@ (defn- block-content-empty? [block] - (let [ast-title (:block.temp/ast-title block) - ast-body (:block.temp/ast-body block) - db-based? (config/db-based-graph? (state/get-current-repo))] - (and - (or db-based? - (property-file/properties-hidden? (:block/properties block))) - - (empty? ast-title) - - (every? #(= % ["Horizontal_Rule"]) ast-body)))) + (string/blank? (:block/title block))) (rum/defcs block-control < rum/reactive [state config block {:keys [uuid block-id collapsed? *control-show? edit? selected?]}] @@ -3371,8 +3362,8 @@ :else block*) - result (merge (or (db/sub-block (:db/id block)) block*) - (select-keys block [:block/level :block.temp/top? :block.temp/bottom?]))] + result (merge block* + (db/sub-block (:db/id block)))] (if linked-block [block* result] [nil result]))) diff --git a/src/main/frontend/components/property/value.cljs b/src/main/frontend/components/property/value.cljs index 9abef21f26..88917c8f94 100644 --- a/src/main/frontend/components/property/value.cljs +++ b/src/main/frontend/components/property/value.cljs @@ -987,28 +987,28 @@ (rum/defc closed-value-item < rum/reactive db-mixins/query [value {:keys [inline-text icon?]}] (when value - (let [eid (if (de/entity? value) (:db/id value) [:block/uuid value])] - (when-let [block (db/sub-block (:db/id (db/entity eid)))] - (let [property-block? (db-property/property-created-block? block) - value' (db-property/closed-value-content block) - icon (pu/get-block-property-value block :logseq.property/icon)] - (cond - icon - (if icon? - (icon-component/icon icon {:color? true}) - [:div.flex.flex-row.items-center.gap-1.h-6 - (icon-component/icon icon {:color? true}) - (when value' - [:span value'])]) + (let [eid (if (de/entity? value) (:db/id value) [:block/uuid value]) + block (or (db/sub-block (:db/id (db/entity eid))) value) + property-block? (db-property/property-created-block? block) + value' (db-property/closed-value-content block) + icon (pu/get-block-property-value block :logseq.property/icon)] + (cond + icon + (if icon? + (icon-component/icon icon {:color? true}) + [:div.flex.flex-row.items-center.gap-1.h-6 + (icon-component/icon icon {:color? true}) + (when value' + [:span value'])]) - property-block? - value' + property-block? + value' - (= type :number) - [:span.number (str value')] + (= type :number) + [:span.number (str value')] - :else - (inline-text {} :markdown (str value')))))))) + :else + (inline-text {} :markdown (str value')))))) (rum/defc select-item [property type value {:keys [page-cp inline-text other-position? property-position _icon?] :as opts}] @@ -1233,7 +1233,7 @@ (concat (->> (for [item items] (rum/with-key (select-item property type item opts) (or (:block/uuid item) (str item)))) - (interpose [:span.opacity-50.-ml-2 ","])) + (interpose [:span.opacity-50.-ml-1 ","])) (when date? [(property-value-date-picker block property nil {:toggle-fn toggle-fn})])) (if date? diff --git a/src/main/frontend/components/views.cljs b/src/main/frontend/components/views.cljs index 0a7afcde7d..c3f2a9cad9 100644 --- a/src/main/frontend/components/views.cljs +++ b/src/main/frontend/components/views.cljs @@ -1089,16 +1089,15 @@ [idx {:keys [full-block-ids properties]} item-render] (let [db-id (util/nth-safe full-block-ids idx) block (db/entity db-id) - [item set-item!] (hooks/use-state block)] + [item set-item!] (hooks/use-state block) + opts {:children? false + :properties properties + :skip-transact? true + :skip-refresh? true}] (hooks/use-effect! (fn [] - (when (and db-id (not (:block.temp/fully-loaded? block))) - (p/let [result (db-async/ (:db/id block) db/entity))))))) [db-id]) diff --git a/src/main/frontend/db/async.cljs b/src/main/frontend/db/async.cljs index 495d512dcc..b1bec03c54 100644 --- a/src/main/frontend/db/async.cljs +++ b/src/main/frontend/db/async.cljs @@ -3,6 +3,7 @@ (:require [cljs-time.coerce :as tc] [cljs-time.core :as t] [cljs-time.format :as tf] + [cljs.cache :as cache] [datascript.core :as d] [frontend.config :as config] [frontend.date :as date] @@ -110,36 +111,44 @@ (cons default-value-id result) result))))) +(defonce *block-cache (atom (cache/lru-cache-factory {} :threshold 1000))) (defn