Fork me on GitHub
#reitit
<
2018-09-11
>
orestis15:09:39

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?

orestis15:09:34

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.

orestis15:09:24

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…

juhoteperi16:09:22

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

juhoteperi16:09:59

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

juhoteperi16:09:27

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

orestis16:09:40

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.

orestis16:09:59

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

👍 1