perf: reduce :block/properties calls on db graphs

`:block.temp/property-keys` was added to get all the properties
for given entity.
This commit is contained in:
Tienson Qin
2025-01-15 19:31:26 +08:00
parent 029a3e07cb
commit 1d9fbc8a3d
10 changed files with 90 additions and 77 deletions

View File

@@ -2,15 +2,15 @@
"Utility fns for properties that are for both file and db graphs.
Some fns like lookup and get-property were written to easily be backwards
compatible with file graphs"
(:require [frontend.state :as state]
[frontend.db.conn :as conn]
(:require [frontend.db.conn :as conn]
[frontend.state :as state]
[logseq.db.frontend.property.util :as db-property-util]))
(defn lookup
"Get the property value by a built-in property's db-ident from coll. For file and db graphs"
[coll key]
"Get the property value by a built-in property's db-ident from block. For file and db graphs"
[block key]
(let [repo (state/get-current-repo)]
(db-property-util/lookup repo coll key)))
(db-property-util/lookup repo block key)))
(defn get-block-property-value
"Get the value of a built-in block's property by its db-ident"
@@ -35,4 +35,4 @@
[block]
(let [repo (state/get-current-repo)
db (conn/get-db repo)]
(db-property-util/shape-block? repo db block)))
(db-property-util/shape-block? repo db block)))