mirror of https://github.com/logseq/logseq
fix: lazy load page
Use rum/with-key to identity page instances to trigger loading for different pages.experiment/tanstack-table
parent
3e04514436
commit
936fe0baaa
|
@ -585,7 +585,7 @@
|
|||
[:div {:key "page-unlinked-references"}
|
||||
(reference/unlinked-references page)])]))))
|
||||
|
||||
(rum/defcs page < rum/reactive db-mixins/query
|
||||
(rum/defcs page-aux < rum/reactive db-mixins/query
|
||||
{:init (fn [state]
|
||||
(let [page-name (:page-name (first (:rum/args state)))
|
||||
page-name' (get-sanity-page-name state page-name)
|
||||
|
@ -602,12 +602,16 @@
|
|||
(when (::page-name state) (state/sub-async-query-loading (::page-name state))))]
|
||||
(if loading?
|
||||
[:div.space-y-2
|
||||
(shui/skeleton {:class "h-6 w-full"})
|
||||
(shui/skeleton {:class "h-6 w-full"})]
|
||||
(rum/with-key
|
||||
(page-inner option)
|
||||
(or (:page-name option)
|
||||
(get-page-name state))))))
|
||||
(shui/skeleton {:class "h-6 w-full"})
|
||||
(shui/skeleton {:class "h-6 w-full"})]
|
||||
(page-inner option))))
|
||||
|
||||
(rum/defcs page
|
||||
[state option]
|
||||
(rum/with-key
|
||||
(page-aux option)
|
||||
(or (:page-name option)
|
||||
(get-page-name state))))
|
||||
|
||||
(rum/defc contents-page < rum/reactive
|
||||
{:init (fn [state]
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
[frontend.components.imports :as imports]
|
||||
[frontend.config :as config]
|
||||
[logseq.db :as ldb]
|
||||
[frontend.db :as db]))
|
||||
[frontend.db :as db]
|
||||
[rum.core :as rum]))
|
||||
|
||||
;; http://localhost:3000/#?anchor=fn.1
|
||||
(def routes
|
||||
|
|
Loading…
Reference in New Issue