Disable db/rebuild-page-blocks-children for now

pull/645/head
Tienson Qin 2020-09-25 10:13:59 +08:00
parent 4a426d7ae8
commit 53e82eafd6
2 changed files with 23 additions and 5 deletions

View File

@ -1018,6 +1018,23 @@
nil)
react)))))
(defn get-page-blocks-no-cache
([page]
(get-page-blocks (state/get-current-repo) page nil))
([repo-url page]
(get-page-blocks repo-url page nil))
([repo-url page {:keys [pull-keys]
:or {pull-keys '[*]}}]
(let [page (string/lower-case page)
page-id (or (:db/id (entity repo-url [:page/name page]))
(:db/id (entity repo-url [:page/original-name page])))
db (get-conn repo-url)]
(when page-id
(let [datoms (d/datoms db :avet :block/page page-id)
block-eids (mapv :e datoms)]
(some->> (pull-many repo-url pull-keys block-eids)
(page-blocks-transform repo-url)))))))
(defn get-page-blocks-count
[repo page-id]
(when-let [db (get-conn repo)]
@ -2284,7 +2301,7 @@
We can improve it if the performance is really an issue."
[repo page]
(let [blocks (->>
(get-page-blocks repo page {:pull-keys '[:block/uuid :block/level :block/pre-block?]})
(get-page-blocks-no-cache repo page {:pull-keys '[:block/uuid :block/level :block/pre-block?]})
(remove :block/pre-block?)
(map #(select-keys % [:block/uuid :block/level]))
(reverse))]

View File

@ -268,10 +268,11 @@
repo
tx
transact-option)
(when (seq pages)
(let [children-tx (mapcat #(db/rebuild-page-blocks-children repo %) pages)]
(when (seq children-tx)
(db/transact! repo children-tx)))))
;; (when (seq pages)
;; (let [children-tx (mapcat #(db/rebuild-page-blocks-children repo %) pages)]
;; (when (seq children-tx)
;; (db/transact! repo children-tx))))
)
(when (seq files)
(file-handler/alter-files repo files)))