Scroll position resetting to 0 on re-render
See original GitHub issueUsing v6.8.0
This is someone else pen, but it works as an example: https://codepen.io/Kamilius/pen/LpObwW?editors=0010
Scroll half way. Change someone’s name that’s visible in the viewport. Table re-renders and scroll position resets to 0.
If I have a dynamically created table, with a lot of records, while I’m viewing this table, a new record is created, the scroll position is reset to 0. I’d then need to scroll back down to my previous position.
React by default doesn’t change the scroll position. This must be a custom function in react-table
is there any way to override/disable this behavior? So upon updating the table with a new record I’m not forced to scroll to my previous position?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Scroll position resetting to 0 on re-render · Issue #963 - GitHub
Scroll half way. Change someone's name that's visible in the viewport. Table re-renders and scroll position resets to 0. If I have a...
Read more >Reset scroll position on component re-render - Stack Overflow
You need to manually change the scrollLeft position to 0 for the div which has overflow: scroll property which in your case is...
Read more >[Solved]-Reset scroll position on component re-render-Reactjs
Coding example for the question Reset scroll position on component re-render-Reactjs.
Read more >scroll bar not reset on refresh - GSAP - GreenSock
run wierd issue that cant figure out i have scrolltrigger and smoothscroll on everything is working and when i refresh page the page ......
Read more >Maintain and restore scroll position in React mobile apps
Learn how to maintain React app scroll position when users close a full-page mobile menu to improve UX by implementing a custom Hook....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pourmesomecode We managed to fix this, we overrode the body component with a function at first, but when we changed it to be a component it fixed it.
i.e:
Came here after running into this issue in 6.7.0. In my case, if React-Table becomes invisible (e.g. in a tabbed interface) and then visible again, it retains the selected row, but fails to retain the scroll position. I worked around this way for now (typescript):
This may well be an abuse of the
onFetchData
event, happy to hear of a better way.