Skip to content
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] Zero (0) integer key display throws #18994

Merged
merged 2 commits into from
Dec 27, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default function useAutocomplete(props) {
const open = isOpenControlled ? openProp : openState;

const inputValueFilter =
!multiple && value && inputValue === getOptionLabel(value) ? '' : inputValue;
Copy link
Member

Choose a reason for hiding this comment

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

We should start linting against these. It's hidden loose equality checking and I think we had like 5-10 issues the last year concerning these. In a typed language this might be ok (if you know the type already is boolean). In a weakly typed language this is dangerous while not improving readability (I'd say it's even worse). The added bytes is negligible.

Copy link
Member

Choose a reason for hiding this comment

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

I also remember a few occurrences of this type of bug. It's fascinating to see the length of which the components get battle-tested.

!multiple && value != null && inputValue === getOptionLabel(value) ? '' : inputValue;

let popupOpen = open;

Expand Down