mirror of
https://github.com/logseq/logseq.git
synced 2026-05-24 04:34:14 +00:00
fix: ensure template blocks fully loaded
This commit is contained in:
@@ -1982,10 +1982,8 @@
|
||||
(insert-template! element-id db-id {}))
|
||||
([element-id db-id {:keys [target] :as opts}]
|
||||
(let [repo (state/get-current-repo)]
|
||||
(p/let [block (db-async/<pull repo db-id)
|
||||
block (when (:block/uuid block)
|
||||
(db-async/<get-block repo (:block/uuid block)
|
||||
{:children? true}))]
|
||||
(p/let [block (db-async/<get-block repo db-id
|
||||
{:include-collapsed-children? true})]
|
||||
(when (:db/id block)
|
||||
(let [journal? (ldb/journal? target)
|
||||
target (or target (state/get-edit-block))
|
||||
@@ -3111,8 +3109,7 @@
|
||||
(:block/uuid page-entity)))
|
||||
repo (state/get-current-repo)
|
||||
_ (db-async/<get-block repo (or block-id page-id)
|
||||
{:children? true
|
||||
:include-collapsed-children? true})
|
||||
{:include-collapsed-children? true})
|
||||
entity (db/entity [:block/uuid (or block-id page-id)])
|
||||
result (or (:block/_page entity)
|
||||
(rest (db/get-block-and-children repo (:block/uuid entity))))
|
||||
@@ -3188,8 +3185,7 @@
|
||||
(defn expand-block! [block-id & {:keys [skip-db-collpsing?]}]
|
||||
(let [repo (state/get-current-repo)]
|
||||
(p/do!
|
||||
(db-async/<get-block repo block-id {:children? true
|
||||
:include-collapsed-children? true})
|
||||
(db-async/<get-block repo block-id {:include-collapsed-children? true})
|
||||
(when-not (or skip-db-collpsing? (skip-collapsing-in-db?))
|
||||
(set-blocks-collapsed! [block-id] false))
|
||||
(state/set-collapsed-block! block-id false))))
|
||||
|
||||
@@ -188,8 +188,7 @@
|
||||
[block-uuid-or-page-name]
|
||||
(p/let [repo (state/get-current-repo)
|
||||
block (db-async/<get-block repo (str block-uuid-or-page-name)
|
||||
{:children? true
|
||||
:include-collapsed-children? true})
|
||||
{:include-collapsed-children? true})
|
||||
_ (when-let [page-id (:db/id (:block/page block))]
|
||||
(when-let [page-uuid (:block/uuid (db/entity page-id))]
|
||||
(db-async/<get-block repo page-uuid)))]
|
||||
@@ -278,8 +277,7 @@
|
||||
|
||||
(def get_block
|
||||
(fn [id ^js opts]
|
||||
(p/let [block (db-async/<get-block (state/get-current-repo) id {:children? true
|
||||
:include-collapsed-children? true})]
|
||||
(p/let [block (db-async/<get-block (state/get-current-repo) id {:include-collapsed-children? true})]
|
||||
(api-block/get_block (:db/id block) (or opts #js {:includePage true})))))
|
||||
|
||||
(def get_current_block
|
||||
|
||||
Reference in New Issue
Block a user