Issue where index is -1 or more than total #1303
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the user does a crazy amount of swapping the component get diff as negative or positive and sometimes result in an overflow 'or' underflow of the index results in the component sort of not responding. This only reset the value to 0 or total if the loop is false
Is it a bugfix ?
Describe what you've done:
It just a minor check if not loop and index is negative or more than total then it reset them to the limit of 0 or total - 1 seeing that total is set to 1 if not passed or 0, this shouldn't cause a NaN
How to test it?
Like a large number of users swipes left and right randomly (guess onScrollEnd to call with diff and x = 0) again only happens for a non-loop scenario.