-
Notifications
You must be signed in to change notification settings - Fork 91
Allow array value select #180
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
Conversation
@Hyperkid123 does this mean that I have to use the |
@skateman |
@@ -164,6 +170,7 @@ Select.defaultProps = { | |||
}, | |||
loadingMessage: 'Loading...', | |||
simpleValue: true, | |||
pluckSingleValue: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could bring some incompatibility issue, if someone uses an actual array as a value for the select.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep i though of that. Check the rest of the code and tests 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that if someone has options like this right now:
[
{ value: ['apple', 'pineapple'], label: 'sweet'},
{ value: ['chocolate','kitkat'], label: 'best'},
]
Then he should have to set this prop to false
and that (he will need to change the schema) will break the backwards compatibility. Am I right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example you posted would not work at this point because we were using ===
to select the value from options instead if isEqual
. So nobody could use it successfully
Okay, then I just have to try it 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
|prop name|type|description| | ||
|---------|----|-----------| | ||
|pluckSingleValue|`bool`|If a value is an array, component will pick its first item and set it as a new value. This will override the value in state from `[2, 4, 5]` to `2` for example.| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be said that it is a true
by default
4a813bc
to
32438b0
Compare
Codecov Report
@@ Coverage Diff @@
## master #180 +/- ##
==========================================
+ Coverage 81.52% 81.53% +0.01%
==========================================
Files 87 87
Lines 1380 1397 +17
Branches 333 336 +3
==========================================
+ Hits 1125 1139 +14
- Misses 211 214 +3
Partials 44 44
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks for the doc changes!
closes #179
Changes
pluckSingleValue
for pf3 select[2, 4, 5]
will result into2
as a value in form state