Dropdown : Dropdown Clear icon persists even when options collection gets empty #6876
Labels
good first issue
*** Welcome to PrimeReact Family! *** Good issue!
Type: Bug
Issue contains a defect related to a specific component.
Milestone
Describe the bug
Hi!
![immagine](https://private-user-images.githubusercontent.com/3284795/348296989-62d4521f-b423-4ace-9199-f867d5a417bd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxOTMzMjEsIm5iZiI6MTczOTE5MzAyMSwicGF0aCI6Ii8zMjg0Nzk1LzM0ODI5Njk4OS02MmQ0NTIxZi1iNDIzLTRhY2UtOTE5OS1mODY3ZDVhNDE3YmQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTBUMTMxMDIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NWE4NGU4OGUwNmNjMThlMDU5YWQyMTJmY2E5NDFjMTAzNmMwZjMwZThjYTFiMzhjZGM3OWVhNmMyYzRjMmNhNiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.gErQGbh9N9G4q9gutWQslq8Rl1A3CVsZgF0YxRqHRnI)
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.
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
Expected behavior
If you programmatically empties the values of the Dropdown, if previously visible the Clear icon should disappear
The text was updated successfully, but these errors were encountered: