fix: view edn export fails for group by

Fixes https://github.com/logseq/db-test/issues/300
This commit is contained in:
Gabriel Horner
2025-06-05 10:07:31 -04:00
parent bcab738d52
commit f6d8595645
5 changed files with 12 additions and 8 deletions

View File

@@ -482,7 +482,7 @@
(:name column))))))
(shui/dropdown-menu-item
{:key "export-edn"
:on-click #(db-export-handler/export-view-nodes-data rows)}
:on-click #(db-export-handler/export-view-nodes-data rows {:group-by? (some? group-by-property-ident)})}
"Export EDN"))))))
(defn- get-column-size

View File

@@ -23,10 +23,12 @@
(notification/show! "Copied block's data!" :success)))
(notification/show! "No block found" :warning)))
(defn export-view-nodes-data [node-ids]
(defn export-view-nodes-data [rows {:keys [group-by?]}]
(p/let [result (state/<invoke-db-worker :thread-api/export-edn
(state/get-current-repo)
{:export-type :view-nodes :node-ids node-ids})
{:export-type :view-nodes
:rows rows
:group-by? group-by?})
pull-data (with-out-str (pprint/pprint result))]
(when-not (= :export-edn-error result)
(.writeText js/navigator.clipboard pull-data)

View File

@@ -681,6 +681,7 @@
(sqlite-export/build-export @conn options)
(catch :default e
(js/console.error "export-edn error: " e)
(js/console.error "Stack:\n" (.-stack e))
(worker-util/post-message :notification
["An unexpected error occurred during export. See the javascript console for details."
:error])