Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown : Dropdown Clear icon persists even when options collection gets empty #6876

Closed
DomenicoMammola opened this issue Jul 12, 2024 · 0 comments · Fixed by #6880, leoo1992/GeradorQRCode#80 or leoo1992/GeradorQRCode#85 · May be fixed by mtech-31-quemistry/quemistry_client_web#20
Labels
good first issue *** Welcome to PrimeReact Family! *** Good issue! Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@DomenicoMammola
Copy link

Describe the bug

Hi!
Put a Dropdown component with "showClear" option, link its options to a collection that is a react state. Let the user select a value. Then clear the options collection. The Dropdown component will show no value but the clear icon ("X") will still stay visible.
immagine

Reproducer

https://stackblitz.com/edit/qeffb1?file=src%2FApp.tsx

PrimeReact version

10.7.0

React version

17.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Add a Dropdown component that has its options filled dinamically
  2. Choose a value in the Dropdown component
  3. Reset state linked to the options of the Dropdown
  4. The Dropdown will be repainted without a selected value (correct) but the clear icon will still be visibile (wrong behaviour)

Expected behavior

If you programmatically empties the values of the Dropdown, if previously visible the Clear icon should disappear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment