question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Autocomplete] with integers as options throw candidate.toLowerCase error

See original GitHub issue

Please see codesandbox at https://codesandbox.io/s/material-demo-ldh7x?file=/demo.js

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

When an autocomplete options prop is only integers, the following error comes:

useAutocomplete.js:44 Uncaught TypeError: candidate.toLowerCase is not a function
    at useAutocomplete.js:44
    at Array.filter (<anonymous>)
    at useAutocomplete.js:40
    at useAutocomplete (useAutocomplete.js:219)
    at Autocomplete (Autocomplete.js:379)
    at renderWithHooks (react-dom.development.js:14803)
    at updateForwardRef (react-dom.development.js:16816)
    at beginWork (react-dom.development.js:18645)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237)

Expected Behavior 🤔

The expected behaviour is to have the autocomplete showing the integers as options and returning them as a result.

Steps to Reproduce 🕹

https://codesandbox.io/s/material-demo-ldh7x?file=/demo.js

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ShwetaPatel1commented, Nov 24, 2020

For me the issue was labels as integer.

const KEY_OPTIONS = [{value: 1, label: 1}, {value: 2, label: 2}, {value: 3, label: '3+'}];

I resolved like this. getOptionLabel={(option) => option.label.toString()}

1reaction
ShwetaPatel1commented, Nov 24, 2020

Asking as a user and not as a contributor. I am facing this issue. How do I solve this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Autocomplete] with integers as options throw candidate ...
When an autocomplete options prop is only integers, the following error comes: useAutocomplete.js:44 Uncaught TypeError: candidate.
Read more >
candidate.toLowerCase is not a function. (In ... - Stack Overflow
I am using AutoComplete API of material ...
Read more >
AutoComplete returning "TypeError: "".toLowerCase is not a ...
If I uncomment ignoreCase: false, then I get the error: Uncaught TypeError: Object [object Object] has no method 'lastIndexOf'.
Read more >
Apache FreeMarker Reference - Digital Assistant
Converts the date from the entity extraction to a string formatted as 11/17/18. The date operator tells FreeMarker that the variable only holds...
Read more >
VMware InstallBuilder User Guide 22
This package allows autocompletion of XML documents against RELAX NG. ... Accessing an undefined variable will not throw an error. Instead, if the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found