-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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] Uncaught TypeError: Cannot read property 'length' of null #20152
Comments
@aaronhayes Please provide a full reproduction test case. This would help a lot 👷 . |
Yep will see what I can put together @eps1lon |
@eps1lon This should be a sufficient test case <Autocomplete
options={options}
getOptionLabel={option => option.label}
value={null}
onChange={(event: any, newValue: any) => {
handleOptionsIdChange(newValue);
}}
multiple={true}
renderInput={params => (
<TextField {...params} label="test" variant="standard" fullWidth />
)}
/> |
I still have problem here in combination with react-form-hooks: Version: "@material-ui/lab": "^4.0.0-alpha.56" |
@ohlr This is not valid, #20152 (comment) throw types and prop-types warnings. |
Why is null not a valid value? the standard autcomplete (I.e. no |
@parksj10 you can provide an empty array instead. |
if you provide an empty array, the autocomplete multiple selection will stop working. |
I was trying to use this hack as I was also getting
|
TypeError · Uncaught TypeError: Cannot read property 'length' of null
https://github.com/mui-org/material-ui/blob/701e3ad76b788a50ea83aeb8516ed303c2435bd0/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js#L821
If
value
isnull
andmultiple
is true, we run into this error. Should add a check forvalue
beingnull
.Version:
"@material-ui/lab": "^4.0.0-alpha.45"
The text was updated successfully, but these errors were encountered: