Przeglądaj źródła

fix: references

Tienson Qin 10 miesięcy temu
rodzic
commit
032c6b9fb2

+ 1 - 1
src/main/frontend/components/block.cljs

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

+ 21 - 16
src/main/frontend/components/views.cljs

@@ -1149,21 +1149,26 @@
   (let [item (util/nth-safe data idx)
   (let [item (util/nth-safe data idx)
         db-id (cond (map? item) (:db/id item)
         db-id (cond (map? item) (:db/id item)
                     (number? item) 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
 (rum/defc table-body < rum/static
   [table option rows *scroller-ref *rows-wrap set-items-rendered!]
   [table option rows *scroller-ref *rows-wrap set-items-rendered!]
@@ -1225,7 +1230,7 @@
       (for [[first-block-id blocks] rows]
       (for [[first-block-id blocks] rows]
         [:div
         [:div
          [:div.ml-2
          [:div.ml-2
-          (breadcrumb config
+          (breadcrumb (assoc config :list-view? true)
                       (state/get-current-repo) first-block-id
                       (state/get-current-repo) first-block-id
                       {:show-page? false})]
                       {:show-page? false})]
          (list-cp blocks)]))))
          (list-cp blocks)]))))