-
Notifications
You must be signed in to change notification settings - Fork 26
[Question] save scroll position between navigations #59
Comments
Can you try changing the order of the HoCs to |
@mridgway I changed it and still fail. import {getNews} from '../actions/newsActions';
export default {
home: {
path: '/',
method: 'get',
page: 'home',
title: 'Home',
handler: require('../components/Home'),
action: getNews
},
about: {
path: '/about',
method: 'get',
page: 'about',
title: 'About',
handler: require('../components/About')
}
}; PS today I uploaded all the app to github |
One of my components it is listening 'scroll' & 'resize'. window.addEventListener('scroll', this.scrollListener);
window.addEventListener('resize', this.scrollListener); To do an infinite scroll (aka load more items) |
I think I can confirm this. I originally wrote the preserveScrollPosition feature for flux-router-component. Both versions seem to differ in one very basic aspect. flux-router-component changes the current route after the route action has been executed, fluxible-router changes it directly on NAVIGATE_START. In case of routes with async actions, the scroll position is being restored before the current route handler has anything to display. @mridgway Can you confirm this? |
Confirmed, we moved pushState to the beginning of navigation. We've had some debates internally whether the scrollTo should be moved to NAVIGATE_SUCCESS and I think we're leaning towards doing just this. I think this would help with the issue at hand as well. |
@mridgway Have you made a decision on how to proceed? |
I believe @dnewcome has been diving into page transition behavior and may have some insight into the how to handle scrolling during navigation. |
I believe #87 will fix this. |
We're going to recommend that you manage the scroll positions on your own and we will provide access to the saved scroll position for pop state. We have found that there's no silver bullet solution for scrolling. It needs to be synchronized with the flow of your application rather than before or after We are not going to remove the current functionality, but we will suggest that if you need better handling, then you should disable scrolling with |
@mridgway thank you for answer. Could you please describe in more details how to receive access to the saved scroll positions. Thxs in advance. |
Scroll position is available on |
Hi,
I used the fluxible-generator and it have the HandleHistory
I read the documentation and it restore automatically the scroll position.
It's working fine if I use the refresh button in the browser, but if I navigated to another page and comeback it do not restore the scroll position.
I used the option preserveScrollPosition
I miss something?
here you can test
Sorry if it is a noov question.
The text was updated successfully, but these errors were encountered: