-
Notifications
You must be signed in to change notification settings - Fork 734
fix picker multi value #1649
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 picker multi value #1649
Conversation
src/components/picker/index.js
Outdated
|
||
if (renderCustomModal) { | ||
const modalProps = { | ||
visible: showExpandableModal, | ||
toggleModal: this.toggleExpandableModal, | ||
onSearchChange: this.onSearchChange, | ||
children, | ||
onDone: () => this.onDoneSelecting(value), | ||
onDone: () => this.onDoneSelecting(multiDraftValue), |
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.
Why is this multiDraftValue
for all types? It seems to be working, but the code is not clear (it is not actually used in single mode). There are other places set up this way.
Not sure we want to "fix" this, did you talk about it with Ethan?
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.
What do you mean by "all types"?
This state value is not used in single mode, therefore its name is multiDraftValue
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.
That's what I've written, but will a future developer know that? - I feel the code is (still) unclear about the fact it's only for MULTI
.
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.
What do you suggest?
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 don't have a simple solution, maybe adding a comment for now.
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.
Approved, merge with\without adding a comment.
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.
@lidord-wix
I agree this specific use case worth a comment.
Let's add a comment and merge
This reverts commit 8dc646f.
Description
Fix bug with picker, now the single picker value is controlled by the user (with the value prop) and the multi picker is controlled by the user (with the value prop) and controlled by the component (with multiDraftValue state and multiFinalValue)
added TODO task to add an initialValue prop in the future to make it more clear to the user in multi mode.
Fix #1615
Changelog
Picker - fix multi mode value