fix(Dropdown): comparison of custom objects#1943
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1943 +/- ##
=========================================
+ Coverage 70.3% 70.3% +<.01%
=========================================
Files 893 893
Lines 7890 7894 +4
Branches 2309 2311 +2
=========================================
+ Hits 5547 5550 +3
- Misses 2330 2331 +1
Partials 13 13
Continue to review full report at Codecov.
|
layershifter
left a comment
There was a problem hiding this comment.
LGTM. @silviuavram do you have any comments?
|
let me take a look because at first glance it's not looking ok. Edit: will leave original comment but maybe I am missing something. I don't like it. If it's Also if you return item.id from it (just to illustrate how you can use it to compare objects), you are breaking the a11y status message: We need another way. |
|
So I will add a new prop, called |
|
@layershifter do you agree with the newly created prop? |
|
@silviuavram Shift suggest naming the new prop as |
|
@lucivpav I am bad at giving names but @jurokapsiar what do you think? |
|
Why I don't like
https://lodash.com/docs/4.17.15#difference ReactSelect uses As we have |
|
Then how about we use |
|
From the API point of view, I like that However, looking at how it needs to be implemented, it is a function that translates the item to a value: so calling it If you would change the signature to then |
|
So the decision is basically whether updating the implementation and renaming the prop for the sake of clarity is worth it or not. I vote yes, there are cases where users just rely on the prop name for understanding the use, and for me the comparator/compare is clearer. If not then at least we should make sure that the prop description is obvious related to its purpose. Up to you @lucivpav . |
|
Thank you for your comments. I am settling on calling the prop |
Resolves #1786