fix: references

This commit is contained in:
Tienson Qin
2025-04-01 15:31:01 +08:00
parent 5923f24f56
commit 032c6b9fb2
2 changed files with 22 additions and 17 deletions

View File

@@ -3176,7 +3176,7 @@
(when (seq breadcrumbs)
[:div.breadcrumb.block-parents
{:class (when (seq breadcrumbs)
(str (when-not (:search? config)
(str (when-not (or (:search? config) (:list-view? config))
" my-2")
(when indent?
" ml-4")))}

View File

@@ -1149,21 +1149,26 @@
(let [item (util/nth-safe data idx)
db-id (cond (map? item) (:db/id item)
(number? item) item
:else nil)]
(when db-id
(let [block-entity (db/entity db-id)
[item set-item!] (hooks/use-state (when (:block.temp/fully-loaded? block-entity) block-entity))
opts {:block-only? true
:properties properties
:skip-transact? (not block-entity)
:skip-refresh? (not block-entity)}]
(hooks/use-effect!
(fn []
(when (and db-id (not item))
(p/let [block (db-async/<get-block (state/get-current-repo) db-id opts)]
(set-item! block))))
[db-id])
(item-render (assoc item :id (:db/id item) :db/id (:db/id item)))))))
:else nil)
block-entity (when db-id (db/entity db-id))
[item set-item!] (hooks/use-state (when (:block.temp/fully-loaded? block-entity) block-entity))
opts {:block-only? true
:properties properties
:skip-transact? (not block-entity)
:skip-refresh? (not block-entity)}]
(hooks/use-effect!
(fn []
(when (and db-id (not item))
(p/let [block (db-async/<get-block (state/get-current-repo) db-id opts)]
(set-item! block))))
[db-id])
(item-render (cond
(map? item)
item
(number? item)
{:db/id item}
:else
nil))))
(rum/defc table-body < rum/static
[table option rows *scroller-ref *rows-wrap set-items-rendered!]
@@ -1225,7 +1230,7 @@
(for [[first-block-id blocks] rows]
[:div
[:div.ml-2
(breadcrumb config
(breadcrumb (assoc config :list-view? true)
(state/get-current-repo) first-block-id
{:show-page? false})]
(list-cp blocks)]))))