[Autocomplete] TypeError: (intermediate value)(intermediate value)(intermediate value).filter is not a function

See original GitHub issue

I am integrating autocomplete component in my website

it is crashing when we type anything in the autocomplete field

it is giving following error

Uncaught TypeError: (intermediate value)(intermediate value)(intermediate value).filter is not a function in autocomplete

My code:

<Autocomplete
            multiple
            id="checkboxes-tags-demo"
            options={users}
            disableCloseOnSelect
            size="small"
            value={values.userIds}
            getOptionSelected={(option, value) => option.id == value.id}
            getOptionLabel={(option) => option.firstName + ' ' + option.lastName}
            renderOption={(option, { selected }) => (
              <React.Fragment>
                <Checkbox
                  icon={icon}
                  checkedIcon={checkedIcon}
                  style={{ marginRight: 8 }}
                  checked={selected}
                  // onChange={(e) => console.log('called12', e.target.value)}
                />
                {option.firstName + ' ' + option.lastName}
              </React.Fragment>
            )}
            style={{ width: '100%' }}
            renderInput={(params) => (
              <Field {...params} label="All Users" fullWidth name="userIds" component={TextField} />
            )}
            onChange={(event, val) => {
              if (val !== null) {
                const items = [];
                val.map((v) => items.push(v));
                setFieldValue('userIds', items);
              }
            }}
          />

my values:

values.userIds = [1,2]; users = [ {id:1,firstName:‘A’, lastName:‘B’}, {id:2,firstName:‘P’, lastName:‘Q’}, {id:3,firstName:‘X’, lastName:‘Y’},];

it is working fine on every other case like clicking on dropdown icon and then choosing the option or removing it by clicking on close icon

but crashing when we start to type anything in the field Capture222

Thanks

Issue Analytics

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

github_iconTop GitHub Comments

6reactions
bipindubey-technoarkcommented, Feb 12, 2021

I fixed the issue actually formik textfield was assigning a value string to the variable. I am now using material ui textfield and it is working fine For people who might get this issue in future

in renderInput function of autocomplete just change

    <Field
                 {...params}
                 label="All Users"
                 fullWidth
                 name="userIds"
                component={TextField}
               />

to

<MuiTextField {...params} label="All Users" fullWidth />

Note: MuiTextfield is material ui textfield and Textfield is formik Textfield

import {
  TextField as MuiTextField,
} from '@material-ui/core';

import { TextField } from 'formik-material-ui';

Thanks

4reactions
ImranHaider313commented, May 18, 2021

In my case I was passing string as default value defaultValue={selectedDiagnosis} while using multiple variant. I just changed the selectedDiagnosis as array and all went well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Autocomplete] TypeError: (intermediate value ... - GitHub
[Autocomplete] TypeError: (intermediate value)(intermediate value)(intermediate value).filter is not a function #24785.
Read more >
Uncaught TypeError: (intermediate value)(...) is not a function
The error is a result of the missing semicolon on the third line: window.Glog = function(msg) { console.log(msg); }; // <--- Add this...
Read more >
TypeError (intermediate value)(...) is not a function in JS
The "TypeError: (intermediate value)(...) is not a function" error occurs when we forget to place a semicolon between a function declaration and an...
Read more >
uncaught typeerror: schema[(intermediate value ... - You.com
The value is called an "intermediate value" because calling the getNum function does not produce the final result of the expression. We later...
Read more >
TypeError: (intermediate value).at is not a function
Change peopleContract to this: var peopleContract = new ETHEREUM_CLIENT.eth.Contract(peopleContractABI, peopleContractAddress);.
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