Skip to content

Ошибка при работе с TextField из библиотеки MUI #182

@oldm79

Description

@oldm79

Приветствую.

Использование.

    const dispatch = useDispatch();
    const clientLastName = useSelector(getClientLastName);
    const idClientLastName = useId();
    const nameErrorClientLastName = clientStatusId === 0 && clientLastName === '';
    const errorClientLastName = clientStatusId === 0 && clientLastName === '' ? 'Не указана фамилия клиента' : '';

                            <Grid2 item width={200}> 
                                <FioSuggestions 
                                    token="suggestToken" 
                                    uid={idClientLastName}
                                    minChars={4}
                                    defaultQuery={clientLastName} 
                                    filterParts={['SURNAME']}
                                    onChange={ (event) => { dispatch(setClientLastName(event?.value)) } }
                                    customInput={TextField} 
                                    inputProps={{
                                        value : clientLastName,
                                        label: "Фамилия", 
                                        variant: "outlined", 
                                        size : "small" ,
                                        sx : { width: 200 }, 
                                        required : true, 
                                        error: nameErrorClientLastName,
                                        helperText: errorClientLastName,
                                        onChange: (event) => { dispatch(setClientLastName(event?.target?.value)) } 
                                    }} 
                                    renderOption={(params) => 
                                        <TextField
                                            {...params} 
                                            variant={"outlined"}
                                            size={"small"}
                                            sx={{ width: 195, input: { cursor: 'pointer' } } } 
                                        />
                                    }
                                />
                            </Grid2>

При выборе подсказки получаю ошибку
Cannot read properties of undefined (reading 'length')
TypeError: Cannot read properties of undefined (reading 'length')
at BaseSuggestions._this.setCursorToEnd (http://localhost:3000/static/js/bundle.js:85088:41)
at http://localhost:3000/static/js/bundle.js:85077:28

Из всех переменных, что задействованы в этом участке кода к length я не обращаюсь.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions