Skip to content

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

Merged
merged 6 commits into from
Nov 14, 2021
Merged

fix picker multi value #1649

merged 6 commits into from
Nov 14, 2021

Conversation

lidord-wix
Copy link
Contributor

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


if (renderCustomModal) {
const modalProps = {
visible: showExpandableModal,
toggleModal: this.toggleExpandableModal,
onSearchChange: this.onSearchChange,
children,
onDone: () => this.onDoneSelecting(value),
onDone: () => this.onDoneSelecting(multiDraftValue),
Copy link
Collaborator

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?

Copy link
Collaborator

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

Copy link
Collaborator

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you suggest?

Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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

@ethanshar ethanshar added the Important for Next Release PR that must be included in the release version label Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Important for Next Release PR that must be included in the release version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Picker. Manually changing the value doesn't work correctly
3 participants