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 getOptionLabel crashing app #20447

Closed
2 tasks done
FernandoGOT opened this issue Apr 6, 2020 · 3 comments
Closed
2 tasks done

Autocomplete getOptionLabel crashing app #20447

FernandoGOT opened this issue Apr 6, 2020 · 3 comments
Labels
component: autocomplete This is the name of the generic UI component, not the React module! support: Stack Overflow Please ask the community on Stack Overflow

Comments

@FernandoGOT
Copy link

The Autocomplete component is breaking our app if we pass an empty option

  • 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 😯

The Autocomplete component is breaking our site

Expected Behavior 🤔

The Autocomplete can't break our site, but return an error or warning

Steps to Reproduce 🕹

Steps:

  1. Put an empty object on your options array
  2. Make sure that the getOptionLabel prop is returning undefined on that empty object
  3. Test your code

https://codesandbox.io/s/bug-report-66yee?file=/demo.js

Context 🔦

It needs to give an error or warning, without breaking our app, since the error is not that clear and can take some time to figure out that the problem is the array

Your Environment 🌎

Tech Version
Material-UI v4.9.9
Material-UI/lab v4.0.0-alpha.48
React v16.13.1
Browser Chrome
@FernandoGOT
Copy link
Author

I saw some associations with #19974 and #19798 but it was a little different, so I created a new issues

@oliviertassinari oliviertassinari added the support: Stack Overflow Please ask the community on Stack Overflow label Apr 6, 2020
@support
Copy link

support bot commented Apr 6, 2020

👋 Thanks for using Material-UI!

We use GitHub issues exclusively as a bug and feature requests tracker, however,
this issue appears to be a support request.

For support, please check out https://material-ui.com/getting-started/support/. Thanks!

If you have a question on StackOverflow, you are welcome to link to it here, it might help others.
If your issue is subsequently confirmed as a bug, and the report follows the issue template, it can be reopened.

@support support bot closed this as completed Apr 6, 2020
@oliviertassinari
Copy link
Member

tip: check the warnings in the console.

@oliviertassinari oliviertassinari added the component: autocomplete This is the name of the generic UI component, not the React module! label May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! support: Stack Overflow Please ask the community on Stack Overflow
Projects
None yet
Development

No branches or pull requests

2 participants