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

Removed 'checkWhenEnabled' flag from source. #279

Closed
wants to merge 1 commit into from

Conversation

rzulkoski
Copy link

The checkWhenEnabled flag is an unnecessary optimization that interferes with filterable lists that are too short to trigger scroll events. It seems reasonable that every time infinite scroll changes from the disabled state to the enabled state it should call its handler to determine if it should scroll.

Here is a common scenario:

  1. You navigate to a page and the handler is triggered once infinite scroll is ready which loads elements in the list until the handler determines it should not scroll anymore.
  2. You allow the user to change some filters (e.g.: DateRange, Status, Type)
  3. You reset your list of elements in preparation for the new data.
  4. You make your service call to retrieve the first x items which includes the new filter criteria, making sure to also disable infinite scroll while waiting for the call to return.
  5. Upon receiving the new data you set your list and then re-enable infinite scroll.
  6. The problem arises if the window is tall enough (or zoomed out enough) that it can render all x elements without the need to scroll.

None of the steps after step 1 listed above would have triggered the handler. I am proposing that the handler should be triggered every time infinite-scroll moves to the enabled state (step 5 above). This would solve the problem and lead to more consistent behavior.

Thanks for your time.

…ptimization that interferes with filterable lists that are too short to trigger scroll events.
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

Successfully merging this pull request may close these issues.

1 participant