-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Autocomplete] Rename getOptionSelected
to isOptionEqualToValue
#26173
[Autocomplete] Rename getOptionSelected
to isOptionEqualToValue
#26173
Conversation
getOptionSelected
to isOptionEqualToValue
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.
Isn't this function just areOptionsEqual<T>(optionA: T, optionB: T): boolean
? As far as I can tell value
is synonymous with selectedOption
.
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.
The name is leaking implementation details. We should use the same name you would use in React.memo
.
areOptionsEqual
is a better name that isn't tied to the current implementation.
The nominal use case for the prop we are discussing is when the I don't follow the implementation detail aspect. This comparison prop only exists because there are two different props: |
We're not comparing options with options. This function compares an option with the selected value (or values, if multiple). |
So I guess this is a matter of angle we pick to look at the problem.
I would vote for giving less weight to the type in this very instance as we have indicators in #23708 that sharing the same type might not be ideal. |
May I push forward this one? I feel we didn't come to an agreement about the name: |
@m4theushw What's your preference on the naming Y? Looking a bit closer at #23708. If we implement a In https://select2.org/getting-started/basic-usage, it's actually simpler, they force you to have the equivalent of |
Just looking on what we have now, I would rename to If we implement the |
Ok, let's move forward with this then. |
Breaking changes
[Autocomplete] Rename
getOptionSelected
toisOptionEqualToValue
to better describe its purpose.Part of #20012
Closes #24855
In the RFC, the suggestion was
optionEqualValue
, but I thinkisOptionEqualToValue
is a better name. It was suggested in #24855 (comment).