fix: lazy load contents

pull/10933/head
Tienson Qin 2024-01-29 18:40:24 +08:00
parent 21c1f4f54c
commit 0a5ca160f9
1 changed files with 9 additions and 5 deletions

View File

@ -202,11 +202,6 @@
{:page page-name})]
(add-button args)))])))))
(defn contents-page
[page]
(when-let [repo (state/get-current-repo)]
(page-blocks-cp repo page {:sidebar? true})))
(rum/defc today-queries < rum/reactive
[repo today? sidebar?]
(when (and today? (not sidebar?))
@ -576,6 +571,15 @@
(or (:page-name option)
(get-page-name state))))
(rum/defc contents-page < rum/reactive
{:init (fn [state]
(db-async/<get-block-and-children (state/get-current-repo) "contents")
state)}
[page]
(when-let [repo (state/get-current-repo)]
(when-not (state/sub-block-unloaded? "contents")
(page-blocks-cp repo page {:sidebar? true}))))
(defonce layout (atom [js/window.innerWidth js/window.innerHeight]))
;; scrollHeight