-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Modify onChange with empty value behaviour for multi select to always pass an empty array #4339
Conversation
🦋 Changeset detectedLatest commit: 07a3997 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 07a3997:
|
4916a29
to
ffb4740
Compare
7e1d2e5
to
82c82fa
Compare
BREAKING CHANGE: react-select is upgraded from v2 to v4. It should not impact you but you should be extra careful around the areas that use a select. Values are now normalized: JedWatson/react-select#4339 The onChange callback receives values that are more coherent now (array if multi select, value is always an array (can be empty), if a single select, value can be object/null. V4 changelog: https://github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md#400 V3 changelog: https://github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md#300
BREAKING CHANGE: react-select is upgraded from v2 to v4. It should not impact you but you should be extra careful around the areas that use a select. Values are now normalized: JedWatson/react-select#4339 The onChange callback receives values that are more coherent now (array if multi select, value is always an array (can be empty), if a single select, value can be object/null. V4 changelog: https://github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md#400 V3 changelog: https://github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md#300
BREAKING CHANGE: react-select is upgraded from v2 to v4. It should not impact you but you should be extra careful around the areas that use a select. Values are now normalized: JedWatson/react-select#4339 The onChange callback receives values that are more coherent now (array if multi select, value is always an array (can be empty), if a single select, value can be object/null. V4 changelog: https://github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md#400 V3 changelog: https://github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md#300
BREAKING CHANGE: react-select is upgraded from v2 to v4. It should not impact you but you should be extra careful around the areas that use a select. Values are now normalized: JedWatson/react-select#4339 The onChange callback receives values that are more coherent now (array if multi select, value is always an array (can be empty), if a single select, value can be object/null. V4 changelog: https://github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md#400 V3 changelog: https://github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md#300
# [48.0.0](v47.6.0...v48.0.0) (2021-03-25) ### Bug Fixes * Remove withPrefix function, that no longer seems necessary ([15a6c6f](15a6c6f)) * Use SVGr icon for example ([696e9a9](696e9a9)) ### Features * Upgrade react-select ([f60569e](f60569e)), closes [/github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md#400](https://github.com//github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md/issues/400) [/github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md#300](https://github.com//github.com/JedWatson/react-select/blob/master/packages/react-select/CHANGELOG.md/issues/300) ### BREAKING CHANGES * react-select is upgraded from v2 to v4. It should not impact you but you should be extra careful around the areas that use a select. Values are now normalized: JedWatson/react-select#4339 The onChange callback receives values that are more coherent now (array if multi select, value is always an array (can be empty), if a single select, value can be object/null.
Resolves #3632.
This change would make it so that the first parameter in
onChange
would always be an array if it’s a multi-select, or always an object/null if it’s a single-select. Right now the behavior is inconsistent in that removing the last value in a multi-select passes a value ofnull
, but clearing all the values at once passes a value of[]
. Always passing an array for multi-select makes it easier for the end user so that they don't have to have a special case to handlenull
.(See #3416 for context.)
Note that this is a breaking change.