fix: query with breadcrumbs show blocks on wrong hierarchy

close #5859
This commit is contained in:
Tienson Qin
2023-03-29 04:42:09 +08:00
parent ecdb68bf65
commit 43bb77322f
2 changed files with 16 additions and 5 deletions

View File

@@ -3699,10 +3699,17 @@
[:div
(page-cp config page)
(when alias? [:span.text-sm.font-medium.opacity-50 " Alias"])]
(for [[parent blocks] parent-blocks]
(rum/with-key
(breadcrumb-with-container blocks config)
(:db/id parent)))
(let [{top-level-blocks true others false} (group-by
(fn [b] (= (:db/id page) (:db/id (first b))))
parent-blocks)
sorted-parent-blocks (concat top-level-blocks others)]
(for [[parent blocks] sorted-parent-blocks]
[:div {:class (if (= (:db/id parent) (:db/id page))
"top-level-matched-blocks"
"nested-matched-blocks")}
(rum/with-key
(breadcrumb-with-container blocks config)
(:db/id parent))]))
{:debug-id page
:trigger-once? false})])))))]