fixed async pagination bugs#3
fixed async pagination bugs#3stepbackj wants to merge 2 commits intoTheSharpieOne:feature/async-paginationfrom
Conversation
b983c1c to
216b7d5
Compare
|
@TheSharpieOne can we have this merged? I will rebase once you're open to it. There are a few ways you can break the paginated async react-select component and this pull request addresses those edge cases. First edge case deals with deleting characters from the input quickly (holding down backspace produces a bug). The component will stay in loading state indefinitely. Second edge case deals with how the react-select component handles refetching if the select begins to run out of options. Currently the only thing that fires an AJAX call is a scroll, which won't happen if the user selects all the available options. |
| this.props.onChange(value); | ||
|
|
||
| if (this.props.pagination) { | ||
| let remainingOptions = this.state.options.length - value.length; |
There was a problem hiding this comment.
What is value here? It can be a string or an object as well as an array. When it is not an array, this line doesn't make much sense.
There was a problem hiding this comment.
ah, you're correct. these fixes were specifically for my use case which was multi-select async pagination. let me test out some of the other edge cases and get back to you with another commit.
| onInputChange(transformedInputValue); | ||
| } | ||
|
|
||
| let oldInputValue = this.state.inputValue; |
There was a problem hiding this comment.
setting state is async. This with the check two lines below will lead to bugs where the loadOptions is not called when it should have been.
Really essential feature so I decided to work off your fork. Found a couple of issues that I've fixed for my personal use