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

Fix Dropdown componentWillReceiveProps to handle setting of state correctly #2521

Closed
wants to merge 2 commits into from

Conversation

mlmassey
Copy link

@mlmassey mlmassey commented Feb 13, 2018

I noted when reviewing issue #2375 that the Dropdown was incorrectly calling setState() multiple times in the componentWillReceiveProps. The main issue is that the functions setValue() and setSelectedIndex() both operate on this.state, even though this.state was not updated correctly by the AutoControlledComponent prior to calling them. This fix addresses this by allowing a callback to be invoked to set further state after the AutoControlledComponent has called setState.

yarn test was run with full tests passing.

@welcome
Copy link

welcome bot commented Feb 13, 2018

💖 Thanks for opening this pull request! 💖

Here is a list of things that will help get it across the finish line:

  • Run yarn lint locally to catch formatting errors. This will fix some errors automatically, commit and push any changes.
  • Run yarn test locally to catch errors. This ensures all components still behave as they should.
  • Run yarn start to run the doc site locally and try a few pages, ensuring everything is in good working order.
  • Include tests when adding/changing behavior.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@mlmassey mlmassey closed this Feb 13, 2018
@mlmassey mlmassey deleted the fix-dropdown-setprops branch February 13, 2018 04:38
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