Merged
Conversation
…able across single and multi
rodlukas
added a commit
to rodlukas/UP-admin
that referenced
this pull request
Jun 7, 2019
kvuli updatu react-select@3 se pri smazani vsech clenu uz nenastavi hodnota pole na [], ale null, s cimz kod nepocital (inicializovalo se na []) - viz. JedWatson/react-select#3416
nafg
added a commit
to nafg/scalajs-facades
that referenced
this pull request
Jun 11, 2020
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.
At the moment, if no value is specified by the consumer, it's instantiated as a null value, regardless of whether the select isMulti or not.
When isMulti is false this is fine. On selection of an option, the value becomes an object, and on clearing of said value, it returns to being null. (null --> {} --> null)
However when isMulti is true, this becomes more inconsistent. On selection of options, the value becomes an array of options, removing values extricates them from this array, removing the last selected value results in an empty array, instead of the initial base state of null. (null --> [{}] --> [])
This PR aims to resolve this inconsistency with the view that when isMulti is true, the value should resolve back to a null when no more options are left in the array, especially since the serialized form value is computed from cleanValue(), which converts null values to an empty array anyways.
@JedWatson @jossmac, is there any context behind this decision that I'm not aware of?
As an aside this change will make supporting the isRequired prop substantially less complex.