You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to replicate the behaviour similar to Twitter's homepage:
After user scrolls feed, navigate somewhere and clicks on "Home" link - the scroll position is restored.
But after he clicks "Home" link again the scroll position is reset.
The first part worked out of the box using <ScrollRestoration getKey={(location) => location.pathname}/> component but I can't find a way to implement the second part.
I was trying to do something like document.scrollingElement.scrollTop = 0 inside clientLoader but seems ScrollRestoration runs after.
I see that remix stores positions in sessionStorage so theoretically I can remove one from there but this feels super hacky
Thanks in advance for any tips 🙇🏻
P.S. hm, seems like it works if I scrollTo in Link's onClick:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I'm trying to replicate the behaviour similar to Twitter's homepage:
After user scrolls feed, navigate somewhere and clicks on "Home" link - the scroll position is restored.
But after he clicks "Home" link again the scroll position is reset.
The first part worked out of the box using
<ScrollRestoration getKey={(location) => location.pathname}/>
component but I can't find a way to implement the second part.I was trying to do something like
document.scrollingElement.scrollTop = 0
inside clientLoader but seems ScrollRestoration runs after.I see that remix stores positions in sessionStorage so theoretically I can remove one from there but this feels super hacky
Thanks in advance for any tips 🙇🏻
P.S. hm, seems like it works if I
scrollTo
in Link'sonClick
:Beta Was this translation helpful? Give feedback.
All reactions