Skip to content

[Autocomplete] renderValue does not render falsy values #46131

Closed
@TobiasKrahn

Description

@TobiasKrahn

Steps to reproduce

Steps:

  1. Open this link to live example: (required)
    https://stackblitz.com/edit/ngv7uzgm?file=src%2FDemo.tsx
  2. Choose Option A
  3. Value will not be rendered

this should be caused by this condition renderValue && value in

} else if (renderValue && value) {

Current behavior

Autocomplete does not get called for falsy values (like 0)

Expected behavior

renderValue should only be skipped for empty arrays, null or undefined as a value

Context

Select a Enum value with an autocomplete

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: Autocomplete, falsy, renderValue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something doesn't workcomponent: autocompleteThis is the name of the generic UI component, not the React module!good first issueGreat for first contributions. Enable to learn the contribution process.ready to takeHelp wanted. Guidance available. There is a high chance the change will be accepted

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions