Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fast scrolling in InfiniteLoader scrolls back to top after data is loaded #595

Closed
XeniaSiskaki opened this issue Feb 24, 2017 · 10 comments
Closed

Comments

@XeniaSiskaki
Copy link

I am using an InfiniteLoader with a Table and the problem I'm having is the following: when I move the scrollbar to the end quickly (or an index where data is not yet loaded), it scrolls back to the top after data is loaded. This problem can also be observed in the demo example here

@vsromanc
Copy link

+1

@bvaughn
Copy link
Owner

bvaughn commented Feb 25, 2017

Ooh, nice bug report.

@bvaughn
Copy link
Owner

bvaughn commented Feb 25, 2017

Looks like it's not specific to Table (which makes sense considering Table and List both use Grid internally). Adding some logging, I see that Grid is getting a "scroll" event with scrollTop:0 for some reason.

Edit 1: Looks like _updateScrollTopForScrollToRow is setting state.scrollTop to 0 for some reason, which causes componentDidUpdate to then scroll the DOM node back to 0 as well.

@bvaughn
Copy link
Owner

bvaughn commented Feb 25, 2017

This looks like something introduced by me recently when I added support for the new async CellMeasurer to Grid. (Sorry!) recomputeGridSize is called by InfiniteLoader once its new rows load. This in turn sets the _recomputeScrollTopFlag flag which causes the chain of methods I mentioned above to be invoked.

This shouldn't matter, since _updateScrollTopForScrollToRow short-circuits if the user hasn't actually specified a scrollToRow- or at least it attempts to 😅 but in this case scrollToRow is null (because of an old, unused state prop in my example) and null >= 0 is true 🤡.

I have to run to an appointment now but the fix for this is simple. I just want to make sure I added at least one regression test first. I'll get it done sometime this morning/afternoon.

bvaughn pushed a commit that referenced this issue Feb 25, 2017
…1 to avoid false positives from null>=0 check. (#595)
@bvaughn
Copy link
Owner

bvaughn commented Feb 25, 2017

Fixed in 2176a5f. Will go out in 9.1.0 shortly.

@bvaughn bvaughn closed this as completed Feb 25, 2017
@XeniaSiskaki
Copy link
Author

Super! Will test it when it's out

@bvaughn
Copy link
Owner

bvaughn commented Feb 27, 2017

It was released with 9.1.0 yesterday.

@nicolasletoublon
Copy link

It seems that this is still happening. Using WindowScroller, InfinitedLoader, Autosizer and List

@vn425282
Copy link

vn425282 commented Nov 4, 2022

may I know any workaround on it ?

@HarvWorks
Copy link

@vn425282 @nicolasletoublon I am guessing you guys don't have a skeleton and are just rendering null in renderActionRow when there is nothing to render.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants