Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

581
Vistas
Mui5 Autocomplete warning

I'm using Material-UI 5 AutoComplete component and I have a warning I can't handle.

The code:

       <Autocomplete
          disableClearable
          options={options}
          value={{ displayName: selectedName || "" }}
          getOptionLabel={(option) => option.displayName || ""}
          onChange={onSelectChange.bind(null, selectedName)}
          isOptionEqualToValue={(option, selected) =>
             option.displayName === selected.displayName
          }
          renderOption={(props, option) => (
            <li {...props}>
              <Typography>{option.displayName}</Typography>
            </li>
          )}
         renderInput={(params) => (
            <TextField
              {...params}
              variant="outlined"
              placeholder={placeholder}
            />)}
        />

The warning:

useAutocomplete.js:220 MUI: The value provided to Autocomplete is invalid.
None of the options match with `{"displayName":""}`.
You can use the `isOptionEqualToValue` prop to customize the equality test.

Every option is an object with a displayName field, (e.g: {displayName})

I saw some posts about it but nothing helped. I'm using a controlled component(value prop) and at the first render the selectedName is empty So I'm getting the error before I'm selecting an item from the list.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Maybe there should be a check in isOptionEqualToValue to check value of selected? Similar like this:

isOptionEqualToValue={(option, value) => {
          if (value === "" || value === option)
              return true;
      }}

Actually to check displayName.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda