Handle more block/name lookup refs

This commit is contained in:
Tienson Qin
2024-04-03 01:00:20 +08:00
parent 96c9605b82
commit 50e3ef5157
7 changed files with 62 additions and 58 deletions

View File

@@ -228,7 +228,7 @@
(let [page (:page default-home)
page (when (and (string? page)
(not (string/blank? page)))
(db/entity [:block/name (util/safe-page-name-sanity-lc page)]))]
(db/entity (ldb/get-first-page-by-name (db/get-db) page)))]
(if page
default-home
(dissoc default-home :page)))))
@@ -655,7 +655,7 @@
(let [page (util/safe-page-name-sanity-lc page)
[db-id block-type] (if (= page "contents")
["contents" :contents]
[(:db/id (db/pull [:block/name page])) :page])]
[(ldb/get-first-page-by-name (db/get-db) page) :page])]
(state/sidebar-add-block! current-repo db-id block-type)))
(reset! sidebar-inited? true))))
(when (state/mobile?)