fix: reactive table

feat/asset-sync
Tienson Qin 2024-07-08 16:33:34 +08:00
parent 0516b868fd
commit 62802b8464
2 changed files with 21 additions and 4 deletions

View File

@ -38,12 +38,17 @@
(ldb/sort-by-order))))
(rum/defc objects-inner < rum/static
[config class properties]
[config class objects properties]
(let [[loading? set-loading?] (rum/use-state nil)
[view-entity set-view-entity!] (rum/use-state nil)
[data set-data!] (rum/use-state [])
[data set-data!] (rum/use-state objects)
columns (views/build-columns config properties)]
(rum/use-effect!
(fn []
(set-data! objects))
[objects])
(rum/use-effect!
(fn []
(set-loading? true)
@ -93,6 +98,9 @@
(when class
(let [class (db/sub-block (:db/id class))
config {:container-id (:container-id state)}
properties (outliner-property/get-class-properties class)]
properties (outliner-property/get-class-properties class)
repo (state/get-current-repo)
objects (->> (db-model/sub-class-objects repo (:db/id class))
(map (fn [row] (assoc row :id (:db/id row)))))]
[:div.ml-2
(objects-inner config class properties)])))
(objects-inner config class objects properties)])))

View File

@ -792,6 +792,15 @@ independent of format as format specific heading characters are stripped"
distinct))
(:block/_tags class))))
(defn sub-class-objects
[repo class-id]
(when class-id
(-> (react/q repo [:frontend.worker.react/objects class-id]
{:query-fn (fn [_]
(get-class-objects repo class-id))}
nil)
react)))
(defn get-all-namespace-relation
[repo]