fix: page property values that are uuids weren't exported

causes more complex schema graph to fail to export
This commit is contained in:
Gabriel Horner
2025-03-10 13:48:25 -04:00
parent c344f4a577
commit c85ce5b17c
2 changed files with 19 additions and 10 deletions

View File

@@ -374,12 +374,14 @@
(defn- build-page-blocks-export [db page-entity {:keys [properties classes blocks] :as options}]
(let [page-ent-export (build-node-export db page-entity (dissoc options :classes :blocks))
page-pvalue-uuids (get-pvalue-uuids (:node page-ent-export))
page (merge (dissoc (:node page-ent-export) :block/title)
(shallow-copy-page page-entity))
page-blocks-export {:pages-and-blocks [{:page page :blocks blocks}]
:properties properties
:classes classes}]
(merge-export-maps page-blocks-export page-ent-export)))
(assoc (merge-export-maps page-blocks-export page-ent-export)
:pvalue-uuids page-pvalue-uuids)))
(defn- get-page-blocks [db eid]
(->> (d/datoms db :avet :block/page eid)
@@ -396,7 +398,8 @@
{:keys [pvalue-uuids] :as blocks-export}
(build-blocks-export db page-blocks options)
page-blocks-export (build-page-blocks-export db page-entity (merge blocks-export options))
page-export (assoc page-blocks-export :pvalue-uuids pvalue-uuids)]
page-block-uuids (set/union pvalue-uuids (:pvalue-uuids page-blocks-export))
page-export (assoc page-blocks-export :pvalue-uuids page-block-uuids)]
page-export))
(defn- build-page-export

View File

@@ -533,8 +533,9 @@
[]
(let [internal-block-uuid (random-uuid)
favorited-uuid (random-uuid)
block-object-uuid (random-uuid)
block-object-uuid2 (random-uuid)
block-pvalue-uuid (random-uuid)
property-pvalue-uuid (random-uuid)
page-pvalue-uuid (random-uuid)
page-object-uuid (random-uuid)
closed-value-uuid (random-uuid)
property-uuid (random-uuid)
@@ -545,7 +546,7 @@
{:user.property/num {:logseq.property/type :number
:block/uuid property-uuid
:build/keep-uuid? true
:build/properties {:user.property/node #{[:block/uuid block-object-uuid2]}}}
:build/properties {:user.property/node #{[:block/uuid property-pvalue-uuid]}}}
:user.property/default-closed
{:logseq.property/type :default
:build/closed-values [{:value "joy" :uuid closed-value-uuid}
@@ -566,7 +567,8 @@
:pages-and-blocks
[{:page {:block/title "page1"
:block/uuid favorited-uuid :build/keep-uuid? true
:build/properties {:user.property/checkbox false}}
:build/properties {:user.property/checkbox false
:user.property/node #{[:block/uuid page-pvalue-uuid]}}}
:blocks [{:block/title "b1"
:build/properties {:user.property/num 1
:user.property/default-closed [:block/uuid closed-value-uuid]
@@ -579,19 +581,23 @@
:blocks []}
{:page {:block/title "page2" :build/tags [:user.class/MyClass2]}
:blocks [{:block/title "hola" :block/uuid internal-block-uuid :build/keep-uuid? true}
{:block/title "myclass object"
{:block/title "myclass object 1"
:build/tags [:user.class/MyClass]
:block/uuid block-object-uuid
:block/uuid block-pvalue-uuid
:build/keep-uuid? true}
{:block/title "myclass object 2"
:build/tags [:user.class/MyClass]
:block/uuid block-object-uuid2
:block/uuid property-pvalue-uuid
:build/keep-uuid? true}
{:block/title "myclass object 3"
:build/tags [:user.class/MyClass]
:block/uuid page-pvalue-uuid
:build/keep-uuid? true}
{:block/title "ref blocks"
:build/children
[{:block/title (str "internal block ref to " (page-ref/->page-ref internal-block-uuid))}
{:block/title "node block"
:build/properties {:user.property/node #{[:block/uuid block-object-uuid]}}}
:build/properties {:user.property/node #{[:block/uuid block-pvalue-uuid]}}}
{:block/title (str "property ref to " (page-ref/->page-ref property-uuid))}
{:block/title (str "class ref to " (page-ref/->page-ref class-uuid))}]}]}
{:page {:build/journal 20250228 :build/properties {:user.property/num 1}}