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] Uncaught TypeError: Cannot read property 'length' of null

See original GitHub issue

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 is null and multiple is true, we run into this error. Should add a check for value being null.

Version: "@material-ui/lab": "^4.0.0-alpha.45"

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
ohlrcommented, Apr 21, 2021

@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 />
            )}
        />
4reactions
oliviertassinaricommented, Apr 23, 2021

@parksj10 you can provide an empty array instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Autocomplete] Uncaught TypeError: Cannot read property ...
If value is null and multiple is true, we run into this error. Should add a check for value being null . Version:...
Read more >
Cannot read property 'length' of undefined JQUERY ...
I am using jQuery Autocomplete for searching users from my DB. Below is controller which returns Json: public function searchusers1() { if ($_ ......
Read more >
Uncaught TypeError: Cannot read property 'length' of null
Sometimes I have this js error: Uncaught TypeError: Cannot read property 'length' of null It can reproduce, if we use the Addressfield ...
Read more >
autocomplete - error: Cannot read property 'title' of nul
Dear supporter, We are using autocomplete in our Angular 5 project. Unfortunately, we got the following error. "null: ERROR null: TypeError: Cannot read...
Read more >
AutoComplete " Cannot read property 'label' of null" - jQuery UI
Hello, I am using jQuery UI 1.8.18 so i can use autocomplete function. It works fine but at times, it throws excpetion from...
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