mirror of
https://github.com/logseq/logseq.git
synced 2026-05-21 11:22:44 +00:00
don't include block property values for all pages
This commit is contained in:
22
deps/db/src/logseq/db/common/sqlite.cljs
vendored
22
deps/db/src/logseq/db/common/sqlite.cljs
vendored
@@ -83,11 +83,13 @@
|
||||
(dissoc property :db/index :db/valueType :db/cardinality)))
|
||||
|
||||
(defn- property-with-values
|
||||
[db block]
|
||||
[db block properties]
|
||||
(when (entity-plus/db-based-graph? db)
|
||||
(let [block (d/entity db (:db/id block))]
|
||||
(->> (:block/properties block)
|
||||
vals
|
||||
(let [block (d/entity db (:db/id block))
|
||||
property-vals (if properties
|
||||
(map block properties)
|
||||
(vals (:block/properties block)))]
|
||||
(->> property-vals
|
||||
(mapcat
|
||||
(fn [property-values]
|
||||
(let [values (->>
|
||||
@@ -104,7 +106,7 @@
|
||||
(map
|
||||
(fn [id] (d/pull db '[*] id))
|
||||
value-ids))
|
||||
;; FIXME: why d/pull returns {:db/id db-ident} instead of {:db/id number-eid}?
|
||||
;; FIXME: why d/pull returns {:db/id db-ident} instead of {:db/id number-eid}?
|
||||
(keep (fn [block]
|
||||
(let [from-property-id (get-in block [:logseq.property/created-from-property :db/id])]
|
||||
(if (keyword? from-property-id)
|
||||
@@ -140,7 +142,8 @@
|
||||
(d/pull-many db '[*] ids')))))
|
||||
|
||||
(defn get-block-and-children
|
||||
[db id {:keys [children? nested-children? properties]}]
|
||||
[db id {:keys [children? nested-children? including-property-vals? properties]
|
||||
:or {including-property-vals? true}}]
|
||||
(let [block (d/entity db (if (uuid? id)
|
||||
[:block/uuid id]
|
||||
id))]
|
||||
@@ -157,8 +160,9 @@
|
||||
(mark-block-fully-loaded block')
|
||||
block')]
|
||||
(cond->
|
||||
{:block block'
|
||||
:properties (property-with-values db block)}
|
||||
{:block block'}
|
||||
including-property-vals?
|
||||
(assoc :properties (property-with-values db block properties))
|
||||
children?
|
||||
(assoc :children
|
||||
(let [page? (common-entity-util/page? block)
|
||||
@@ -180,7 +184,7 @@
|
||||
(let [e (d/entity db (:db/id block))]
|
||||
(conj
|
||||
(if (seq (:block/properties e))
|
||||
(vec (property-with-values db e))
|
||||
(vec (property-with-values db e nil))
|
||||
[])
|
||||
block)))))))))))))
|
||||
|
||||
|
||||
@@ -1241,7 +1241,7 @@
|
||||
(db-async/<get-block (state/get-current-repo) block-id :children? false))
|
||||
state)}
|
||||
[config id label]
|
||||
(if (= (:block/uuid (:block config)) id)
|
||||
(if (and id (= (:block/uuid (:block config)) id))
|
||||
[:span.warning.text-sm "Self reference"]
|
||||
(if-let [block-id (and id (if (uuid? id) id (parse-uuid id)))]
|
||||
(if (state/sub-async-query-loading (str block-id))
|
||||
|
||||
@@ -522,21 +522,18 @@
|
||||
:cell (fn [_table _row _column])})
|
||||
unpinned)
|
||||
sized-columns (get-in table [:state :sized-columns])
|
||||
row-cell-f (fn [column {:keys [hide?]}]
|
||||
(let [id (str (:id row) "-" (:id column))
|
||||
render (get column :cell)
|
||||
width (get-column-size column sized-columns)
|
||||
select? (= (:id column) :select)
|
||||
add-property? (= (:id column) :add-property)
|
||||
style {:width width :min-width width}
|
||||
cell-opts {:key id
|
||||
:select? select?
|
||||
:add-property? add-property?
|
||||
:style style}]
|
||||
(if hide?
|
||||
[:div.h-8 {:style style}]
|
||||
(when render
|
||||
(shui/table-cell cell-opts (render table row column))))))]
|
||||
row-cell-f (fn [column {:keys [_lazy?]}]
|
||||
(when-let [render (get column :cell)]
|
||||
(let [id (str (:id row) "-" (:id column))
|
||||
width (get-column-size column sized-columns)
|
||||
select? (= (:id column) :select)
|
||||
add-property? (= (:id column) :add-property)
|
||||
style {:width width :min-width width}
|
||||
cell-opts {:key id
|
||||
:select? select?
|
||||
:add-property? add-property?
|
||||
:style style}]
|
||||
(shui/table-cell cell-opts (render table row column)))))]
|
||||
(shui/table-row
|
||||
(merge
|
||||
props
|
||||
@@ -545,7 +542,7 @@
|
||||
[:div.sticky-columns.flex.flex-row
|
||||
(map #(row-cell-f % {}) pinned-columns)]
|
||||
[:div.flex.flex-row
|
||||
(map #(row-cell-f % {}) unpinned-columns)])))
|
||||
(map #(row-cell-f % {:lazy? true}) unpinned-columns)])))
|
||||
|
||||
(rum/defc table-row < rum/reactive db-mixins/query
|
||||
[table row props option]
|
||||
@@ -1093,16 +1090,18 @@
|
||||
(let [db-id (util/nth-safe full-block-ids idx)
|
||||
[item set-item!] (hooks/use-state
|
||||
(or (db/entity db-id)
|
||||
(get-in view-entity [:cached-item db-id])))]
|
||||
(get-in view-entity [:cached-item db-id])))
|
||||
skip-transact? (contains? #{:all-pages} (:logseq.property.view/feature-type view-entity))]
|
||||
(hooks/use-effect!
|
||||
(fn []
|
||||
(when (and db-id (not item))
|
||||
(p/let [result (db-async/<get-block
|
||||
(state/get-current-repo) db-id
|
||||
{:children? false
|
||||
:skip-transact? true
|
||||
:skip-transact? skip-transact?
|
||||
:properties properties
|
||||
:cache? false})]
|
||||
:cache? false
|
||||
:including-property-vals? (not skip-transact?)})]
|
||||
(let [e (db/entity (:db/id (:block result)))
|
||||
e' (or e (:block result))]
|
||||
(when e' (assoc-in view-entity [:cached-item db-id] e'))
|
||||
|
||||
Reference in New Issue
Block a user