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

List 8.6.x setting scrollTop breaks scrolling? #490

Closed
bhj opened this issue Dec 2, 2016 · 12 comments
Closed

List 8.6.x setting scrollTop breaks scrolling? #490

bhj opened this issue Dec 2, 2016 · 12 comments
Labels

Comments

@bhj
Copy link
Contributor

bhj commented Dec 2, 2016

Hi, I have a List where I'm setting the initial position on mount via the scrollTop prop. Up through 8.5.3 it works fine, but with 8.6.0 and 8.6.1 no new rows are rendered while scrolling. It seems to be using the static scrollTop prop rather than the current position during a scroll when calculating which rows to render?

@bvaughn
Copy link
Owner

bvaughn commented Dec 3, 2016

Potentially related to the 8.6.0 release, specifically PR #482. cc @bradchristensen, @mbrevda

@bvaughn
Copy link
Owner

bvaughn commented Dec 3, 2016

I'm at work still but I'll try to make time to look at this this evening. Worst case, I will revert the PR that introduced the regression and then we can work with @bradchristensen at getting it re-submitted.

@bhj
Copy link
Contributor Author

bhj commented Dec 3, 2016

@bvaughn Have an evening :) and thanks for all your work!

@fritz-c
Copy link
Contributor

fritz-c commented Dec 3, 2016

I had a similar issue in my react-sortable-tree library at v0.1.7, so if you need to reproduce, just build the example page with npm install && npm start.

I had apparently been setting the scrollTop to something at one point in time with scrollToPixel, but that got phased out, and the broken <= v0.1.7 versions were just constantly passing it scrollTop={null}. Since this was just a programming oversight on my part, I fixed it immediately, and everything was back to normal.

@bradchristensen
Copy link
Contributor

The use case you have would be broken by #482, because what you're doing is setting the component to be controlled (by defining the scrollTop prop) and then expecting it to function in an uncontrolled way from then on (i.e. ignoring the scrollTop prop). With #482, a controlled Grid component will remain controlled. You should find that you can fix this on your end by keeping the scrollTop prop updated with the new scrollTop that you obtain from onScroll. Otherwise, to make the Grid function the way you're currently using it but without it being a controlled component, we would need to introduce a defaultScrollTop prop. (relevant reading)

That being said though, as this is a breaking change for you and others, I think it would be wise to revert it for the 8.x release and re-release it with the next major version. Like @fritz-c mentioned, there are probably others also setting the scrollTop on initial mount without actually making use of it and it would be a shame for this change to break that.

@bhj
Copy link
Contributor Author

bhj commented Dec 3, 2016

@bradchristensen thanks for the clarification and makes total sense. I'd be happy with a defaultScrollTop or initialScrollTop.

Currently I'm feeding the scrollTop value passed to my onScroll handler back to List, but with Redux in the middle because I need to persist the position in the list across life cycles. So basically there are (throttled) actions periodically updating List's scrollTop and I've just been lucky its been ignoring those during scrolling.

@bvaughn
Copy link
Owner

bvaughn commented Dec 3, 2016

That being said though, as this is a breaking change for you and others, I think it would be wise to revert it for the 8.x release and re-release it with the next major version. Like @fritz-c mentioned, there are probably others also setting the scrollTop on initial mount without actually making use of it and it would be a shame for this change to break that.

Agreed. This sounds like the correct way forward.

I will put out a release with this change reverted.

@bvaughn
Copy link
Owner

bvaughn commented Dec 3, 2016

I won't revert the whole change set, just the part that impacts controlled vs uncontrolled. There's also a good fix here and coverage from a new test here.

bvaughn pushed a commit that referenced this issue Dec 3, 2016
…the behavior regarding controlled/uncontrolled and props and in a way that was not backwards compatible. (See issue #490 for more.)
@bvaughn
Copy link
Owner

bvaughn commented Dec 3, 2016

Fix released as 8.7.1.

My apologies for the error. Thank you for reporting it so quickly, @bhj. And thanks for chiming in so quickly @bradchristensen and @fritz-c.

@mbrevda
Copy link
Contributor

mbrevda commented Dec 4, 2016

thanks for the revert @bvaughn! @bradchristensen will you be opening another PR for the next major version with the desired changes?

@bvaughn
Copy link
Owner

bvaughn commented Dec 4, 2016 via email

@bradchristensen
Copy link
Contributor

Totally fine by me! Give me a cc when you're next planning a release and I'll be keen to get in there with a PR 😄

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

No branches or pull requests

5 participants