Skip to content

Picker multi select support #871

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
Aug 6, 2020
Merged

Conversation

mendyEdri
Copy link
Contributor

Support Picker multi-selection

Comment on lines 196 to 198
if (this.isDialogAndMultiSelectInEditing()) {
return undefined;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we returning undefined here..?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't want to update the outer-textfield with the selection while the user selecting, until they tap on 'Done'

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ohh ok.
I think that we need to solve the root cause of this issue.
By returning "undefined" we're just hiding the value, but technically it's still being store in the state's value.

I think the right place to handle this issue is in the toggleItemSelection function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking out loud:
there is a single state to represent the selected items.
then callbacks are called upon user events and then, it invokes with the current state value.

The only place reacting to those state changes is this label, and I didn't want to make extra state value to hold the same data.

I can make it more intuitive by passing to getLabel() the source it should work on (props.value / state.value).

WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

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

But fixing the getLabel doesn't fix the source of truth in this case. the value in state.

Technically if in the future we'll add a new feature that depends on the state value, this feature will be broken because it will depend on a wrong value.

I believe that by fixing what we store in the state's value we're fixing the root problem
and not worry about whatever logic depends on it.

@mendyEdri mendyEdri requested a review from ethanshar August 5, 2020 10:33
@ethanshar ethanshar merged commit 13ca81b into master Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants