Skip to content

[MUI v9] Autocomplete value widget crashes — "Cannot read properties of undefined (reading 'endAdornment')" (renderInput uses removed InputProps API) #1324

Description

@tangentlin

Describe the bug

When @react-awesome-query-builder/mui is used with Material UI v9 (@mui/material@9.x), the MUI Autocomplete value widget throws at render time:

TypeError: Cannot read properties of undefined (reading 'endAdornment')
    in ForwardRef(Autocomplete)

This takes down the whole query builder (only caught by a surrounding error boundary) as soon as a rule with an Autocomplete-based value widget is shown.

To Reproduce

  1. Install @react-awesome-query-builder/mui@6.6.15 with @mui/material@9.1.1 (React 19).
  2. Render <Query ... /> with a config that produces an Autocomplete value widget (e.g. a multiselect field, or an autocomplete/async-search widget).
  3. The Autocomplete crashes on first render with the error above.

Expected behavior

The Autocomplete value widget renders normally.

Root cause

In modules/widgets/value/MuiAutocomplete.jsx, the renderInput callback reads params.InputProps.endAdornment and passes InputProps / inputProps to <TextField>:

const renderInput = (params) => (
  <TextField
    variant="standard"
    {...params}
    inputProps={{ "aria-label": ariaLabel, ...params.inputProps, value: renderValue }}
    InputProps={{
      ...params.InputProps,
      readOnly: readonly,
      endAdornment: (
        <React.Fragment>
          {isLoading ? <CircularProgress color="inherit" size={20} /> : null}
          {params.InputProps.endAdornment}
        </React.Fragment>
      ),
    }}
    ...
  />
);

Material UI v9 changed the Autocomplete renderInput(params) shape: the input props now live under params.slotProps.input (and params.slotProps.htmlInput) — params.InputProps / params.inputProps no longer exist. In addition, TextField removed the InputProps / inputProps props in favor of the slots / slotProps API. So params.InputProps is undefined, and reading .endAdornment on it throws.

The other value widgets (MuiText, MuiNumber, etc.) pass InputProps as a TextField prop; under v9 those props are silently ignored, so those widgets don't crash but lose their adornments / readOnly state.

Environment

  • @react-awesome-query-builder/mui: 6.6.15
  • @mui/material: 9.1.1
  • React: 19
  • Browser: Chrome

Additional context

Related to #1298 (Support for MUI 7): RAQB declares @mui/material peerDependency "^5.2.4 || ^6.0.0", so MUI 7/8/9 are unsupported. This issue documents the concrete runtime break under v9 (the Autocomplete/TextField slot-API migration), which is distinct from the install/peer-dependency aspect tracked in #1298. Happy to open a PR migrating the MUI value widgets' renderInput to the v9 slotProps API if that would be welcome.

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