chore: clean up repeated uses of fetching page+property uuids

This commit is contained in:
Gabriel Horner
2023-10-24 09:28:44 -04:00
parent 56e5d1b936
commit 241384c9be
13 changed files with 58 additions and 50 deletions

View File

@@ -20,19 +20,20 @@
"Updates DB graph blocks to ensure that built-in properties are using uuids
for property ids"
[blocks]
(if (config/db-based-graph? (state/get-current-repo))
(map (fn [b]
(if (:block/properties b)
(-> b
(dissoc :block/properties-order)
(update :block/properties
(fn [props]
(update-keys props #(if (contains? db-property/built-in-properties-keys %)
(pu/get-built-in-property-uuid %)
%)))))
b))
blocks)
blocks))
(let [repo (state/get-current-repo)]
(if (config/db-based-graph? repo)
(map (fn [b]
(if (:block/properties b)
(-> b
(dissoc :block/properties-order)
(update :block/properties
(fn [props]
(update-keys props #(if (contains? db-property/built-in-properties-keys %)
(pu/get-built-in-property-uuid repo %)
%)))))
b))
blocks)
blocks)))
(defn extract-blocks
"Wrapper around logseq.graph-parser.block/extract-blocks that adds in system state