Modify onChange with empty value behaviour for multi select to always pass an empty array#4339
Merged
JedWatson merged 9 commits intoJedWatson:masterfrom Jan 22, 2021
Merged
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
JedWatson
approved these changes
Jan 22, 2021
Merged
This was referenced Jan 22, 2021
ptbrowne
added a commit
to cozy/cozy-ui
that referenced
this pull request
Mar 24, 2021
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
ptbrowne
added a commit
to cozy/cozy-ui
that referenced
this pull request
Mar 24, 2021
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
ptbrowne
added a commit
to cozy/cozy-ui
that referenced
this pull request
Mar 24, 2021
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
ptbrowne
added a commit
to cozy/cozy-ui
that referenced
this pull request
Mar 24, 2021
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
cozy-bot
pushed a commit
to cozy/cozy-ui
that referenced
this pull request
Mar 25, 2021
# [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.
This was referenced Sep 11, 2021
This was referenced Sep 24, 2021
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves #3632.
This change would make it so that the first parameter in
onChangewould 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.