mirror of https://github.com/logseq/logseq
fix: preserve the scroll position when navigating pages
parent
062c2523bc
commit
e649650d28
|
@ -148,6 +148,7 @@
|
|||
(when @*scroll-timer
|
||||
(js/clearTimeout @*scroll-timer))
|
||||
(state/set-state! :ui/scrolling? true)
|
||||
(state/save-scroll-position! (util/scroll-top))
|
||||
(reset! *scroll-timer (js/setTimeout
|
||||
(fn [] (state/set-state! :ui/scrolling? false)) 500)))
|
||||
false)))
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
[{:keys [to path-params query-params push]
|
||||
:or {push true}}]
|
||||
(let [route-fn (if push rfe/push-state rfe/replace-state)]
|
||||
(state/save-scroll-position! (util/scroll-top))
|
||||
(route-fn to path-params query-params))
|
||||
;; force return nil for usage in render phase of React
|
||||
nil)
|
||||
|
@ -126,9 +125,10 @@
|
|||
(update-page-label! route)
|
||||
(if-let [anchor (get-in route [:query-params :anchor])]
|
||||
(jump-to-anchor! anchor)
|
||||
(util/scroll-to (util/app-scroll-container-node)
|
||||
(js/setTimeout #(util/scroll-to (util/app-scroll-container-node)
|
||||
(state/get-saved-scroll-position)
|
||||
false))))
|
||||
true)
|
||||
100))))
|
||||
|
||||
(defn go-to-search!
|
||||
[search-mode]
|
||||
|
|
Loading…
Reference in New Issue