Allow setState in onSelect (fixes #51) #110
Merged
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.
Post my comment in #51, I investigated this issue some more and concluded that the problem was in making a decision based on reading from outdated local state. I'll repeat what I wrote in my commit message here:
This PR seems to fix the problem, but there are some things I'm unsure about and would love some input on (cc @danez):
setState
call to the focus example to illustrate that it works, but I didn't document that and tbh am not sure how/where I'd do that. I also suspect thethis.forceUpdate()
call that's in there was to make sure an update was triggered when something was typed into the input, but since I've got thesetState
call in there now an update will be triggered anyway, so we can probably remove theforceUpdate
.Tabs#componentWillReceiveProps
may not be clear enough