mirror of
https://github.com/logseq/logseq.git
synced 2026-05-29 15:09:41 +00:00
fix(mobile): partial blocks when navigating back to the home tab
This commit is contained in:
@@ -4452,10 +4452,8 @@
|
||||
|
||||
(rum/defc block-list
|
||||
[config blocks]
|
||||
(let [mobile? (util/mobile?)
|
||||
[ready? set-ready?] (hooks/use-state
|
||||
(not (and mobile? (not (:journals? config)))))
|
||||
[virtualized? _] (hooks/use-state (not (or (util/rtc-test?)
|
||||
(let [[virtualized? _] (hooks/use-state (not (or (util/rtc-test?)
|
||||
(and (util/mobile?) (:journals? config))
|
||||
(if (:journals? config)
|
||||
(< (count blocks) 50)
|
||||
(< (count blocks) 10))
|
||||
@@ -4496,7 +4494,6 @@
|
||||
*wrap-ref (hooks/use-ref nil)]
|
||||
(hooks/use-effect!
|
||||
(fn []
|
||||
(when mobile? (util/schedule #(set-ready? true)))
|
||||
(when virtualized?
|
||||
(when (:current-page? config)
|
||||
(let [ref (.-current *virtualized-ref)]
|
||||
@@ -4525,14 +4522,13 @@
|
||||
[:div.blocks-list-wrap
|
||||
{:data-level (or (:level config) 0)
|
||||
:ref *wrap-ref}
|
||||
(when ready?
|
||||
(cond
|
||||
virtualized?
|
||||
(ui/virtualized-list virtual-opts)
|
||||
:else
|
||||
(map-indexed (fn [idx block]
|
||||
(rum/with-key (render-item idx) (str (:container-id config) "-" (:db/id block))))
|
||||
blocks)))]))
|
||||
(cond
|
||||
virtualized?
|
||||
(ui/virtualized-list virtual-opts)
|
||||
:else
|
||||
(map-indexed (fn [idx block]
|
||||
(rum/with-key (render-item idx) (str (:container-id config) "-" (:db/id block))))
|
||||
blocks))]))
|
||||
|
||||
(rum/defcs blocks-container < mixins/container-id rum/static
|
||||
{:init (fn [state]
|
||||
|
||||
@@ -100,8 +100,6 @@
|
||||
(rum/defc main-content < rum/static
|
||||
[tab route-match]
|
||||
(let [view (get-in route-match [:data :view])
|
||||
;; We are on the journals home screen if the tab is :home
|
||||
;; AND there is no view (e.g. not viewing a specific journal page)
|
||||
home? (and (= tab "home") (nil? view))]
|
||||
;; Two-layer structure:
|
||||
;; - Journals layer keeps its own scroll container and is always in the DOM.
|
||||
@@ -109,13 +107,11 @@
|
||||
;; Both are absolutely positioned and stacked; we toggle visibility.
|
||||
[:div.h-full.relative
|
||||
;; Journals scroll container (keep-alive)
|
||||
;; This element stays mounted permanently and only toggles visibility.
|
||||
[:div#app-main-home.px-5.absolute.inset-0.overflow-y-auto
|
||||
{:class (when-not home? "invisible pointer-events-none")}
|
||||
(home)]
|
||||
|
||||
;; Other pages: search, settings, specific page, etc.
|
||||
;; These views scroll independently from the journals layer.
|
||||
(when-not home?
|
||||
(other-page view tab route-match))]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user