-
Notifications
You must be signed in to change notification settings - Fork 13
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
refactor(select): make selection string based #12
Conversation
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.
Looks good, I think you got basically everything 🤘. Just a couple of very minor things:
- We should also update the error message in MultiSelect/SelectionList.js line 20 - 22 (Github won't let me leave a comment directly for some reason).
- Same for line 12 - 14 of SingleSelect/Selection.js.
- And unrelated, but 119 - 123 of Select/Select.js looks redundant. Maybe that changed when implementing the popperized Menu?
edit: One thing we could do is also add some tests for what will happen with duplicate values (and other data the Select will process, but not function correctly with). So that we know how it fails, and can make sure that the failure won't change as well.
Now that we do not rely on the label + value, we could change the Option implementations to use the pattern we use elsewhere where the label is the children:
May be a different PR if we do that though. |
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.
None of the commits that introduce breaking changes has a proper commit message.
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 addressing the comments. I'm not sure about this part of the error message change:
The selected value could not be found in a child of the select.
.
To me that seems slightly difficult to understand. Maybe we could be more explicit, and word it as: There is no option with the value: "${value}". Make sure that all the values passed to the selected prop match an existing option.
The rest of the changes seem good to me 👍
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.
And this:
One thing we could do is also add some tests for what will happen with duplicate values (and other data the Select will process, but not function correctly with). So that we know how it fails, and can make sure that the failure won't change as well.
Do you think that'd be better suited as a follow up PR, or in this one? (Or not at all is also an option of course)
Good catch. I'll squash my commits and add a correct footer
I'll look into this as well. It should end up being a passing test on "failing" behaviour. It'd be good to add, but I might require some assistance.... |
Done in 7db3e9f |
I think that that'll break the assumption the Select wrapper makes an the options having a label prop. I believe it uses that for filtering for example. I would retain the current option implementation. If devs need to pass something as a child they have the option to create a custom option, whilst retaining the label prop (and other assumptions the select makes about the options). Maybe we shouldn't change too much in this PR to keep the changes manageable. |
Yeah, I can confirm that this is in fact happening. Somehow the test was green for me locally, but the test run here just failed due to filtering. I think filtering based on children is not really a valid approach. So I'll revert 7db3e9f. I am still working on a test for the duplicate value behaviour though. |
bd07c9e
to
4401ee9
Compare
@varl @ismay I think this PR is now ready for a final re-review:
|
cypress/integration/SingleSelect/duplicate_option_values.feature
Outdated
Show resolved
Hide resolved
cypress/integration/MultiSelect/duplicate_option_values.feature
Outdated
Show resolved
Hide resolved
BREAKING CHANGE: - SingleSelect selection is now a string instead of an object with a value and label property - MultiSelect selection is now an array of strings instead of an array of objects with a value and label property
a679cf2
to
e3627a4
Compare
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 modifications @HendrikThePendric, this looks good to merge to me (assuming that the tests will pass).
🎉 This PR is included in version 5.0.0-alpha.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 5.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
I've addressed the following:
All tests are green and when I do a full test run, I don't seem to be collecting any prop-type errors, so I think I've caught everything.
However, this PR touched a lot of files, so I won't be surprised if we end up finding some little issues.