Fork me on GitHub

Reitit frontend looks very slick so far. Do you have any plans to support some form of solving the scroll position problem that most React-based apps have?


i.e. I have a long list of things. I scroll down to 2000px. I click a link that changes the route, re-renders my page, now I’m at 2000px down. Scroll back up again to see the new content. Press back, whoops, now the previous list is at the top again.


I don’t think it’s a solved problem anywhere, ReactRouter used to solve it, but now in v4 they say browsers start to deal with this already, but it doesn’t seem to be solved to me…


I haven't encountered such problems. Perhaps because the apps I often work only have certain scrollable elements and page itself is not scrollable.


Not sure what solving it would require, but probably route change handler would be good place to handle it.


Or is the problem specific to using HTML5 history instead of fragments?


I’m not so sure myself. The way it’s meant to be solved is to record the scrollPosition, store it somewhere (I think the history API has a way to store data, but it seems reitit passes nil there) then a) onPopState restore it and b) on pushState scroll back to the top.


I will dig a little bit deeper — just wanted to ask whether it’s already on the planned list or not.

👍 4