Fix basePicker createGenericItem handling.#3519
Merged
Merged
Conversation
Contributor
Author
|
Please wait with merging.. |
Contributor
Author
|
the tests are passing now. |
joschect
suggested changes
Jan 16, 2018
joschect
left a comment
Contributor
There was a problem hiding this comment.
I've got just a few suggestions but other
| this.suggestions = []; | ||
| this.currentIndex = -1; | ||
| this._ensureSuggestionModel = this._ensureSuggestionModel.bind(this); | ||
| this._isSuggestionModel = this._isSuggestionModel.bind(this); |
| private _onValidateInput() { | ||
| if (this.props.onValidateInput && (this.props.onValidateInput as any)(this.input.value) !== ValidationState.invalid && this.props.createGenericItem) { | ||
| let itemToConvert = (this.props.createGenericItem as any)(this.input.value, (this.props.onValidateInput as any)(this.input.value)); | ||
| let itemToConvert = (this.props.createGenericItem as (input: string, ValidationState: ValidationState) => ISuggestionModel<T>)(this.input.value, (this.props.onValidateInput as any)(this.input.value)); |
Contributor
There was a problem hiding this comment.
You don't need the as here anymore since it's not any.
joschect
approved these changes
Jan 22, 2018
joschect
left a comment
Contributor
There was a problem hiding this comment.
One last suggestion, otherwise looks good.
| private _onValidateInput() { | ||
| if (this.props.onValidateInput && (this.props.onValidateInput as any)(this.input.value) !== ValidationState.invalid && this.props.createGenericItem) { | ||
| let itemToConvert = (this.props.createGenericItem as any)(this.input.value, (this.props.onValidateInput as any)(this.input.value)); | ||
| let itemToConvert = this.props.createGenericItem(this.input.value, (this.props.onValidateInput)(this.input.value)); |
Contributor
There was a problem hiding this comment.
Don't need these extra parens around this.props.onValidateInput
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Pull request checklist
$ npm run changeDescription of changes
Added logic in the
SuggestionsController.convertSuggestionsToSuggestionItems()to handle being called with eitherISuggestionModel<T>orTIt addresses an issue where when using a pickers createGenericItem, items are not resolved correctly.