Skip to content

Commit

Permalink
fix: only display ordered columns for imported :query-properties
Browse files Browse the repository at this point in the history
fixes LOG-3230
  • Loading branch information
logseq-cldwalker committed Nov 25, 2024
1 parent 96f0415 commit 707bdeb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/frontend/components/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1185,8 +1185,16 @@
[sorting set-sorting!] (rum/use-state (or sorting [{:id :block/updated-at, :asc? false}]))
filters (:logseq.property.table/filters view-entity)
[filters set-filters!] (rum/use-state (or filters []))
hidden-columns (:logseq.property.table/hidden-columns view-entity)
[visible-columns set-visible-columns!] (rum/use-state (zipmap hidden-columns (repeat false)))
default-visible-columns (if-let [hidden-columns (:logseq.property.table/hidden-columns view-entity)]
(zipmap hidden-columns (repeat false))
;; This case can happen for imported tables
(if (seq (:logseq.property.table/ordered-columns view-entity))
(zipmap (set/difference (set (map :id columns))
(set (:logseq.property.table/ordered-columns view-entity))
#{:select :block/created-at :block/updated-at})
(repeat false))
{}))
[visible-columns set-visible-columns!] (rum/use-state default-visible-columns)
ordered-columns (vec (concat [:select] (:logseq.property.table/ordered-columns view-entity)))
sized-columns (:logseq.property.table/sized-columns view-entity)
[ordered-columns set-ordered-columns!] (rum/use-state ordered-columns)
Expand Down

0 comments on commit 707bdeb

Please sign in to comment.