MultiSelect: Clear button is visible when field has empty array as value #14145
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
In PrimeNG < 16.7.1 one could populate a
FormControl
that is bound to a<p-multiSelect [showClear]="true">
with an empty array and the clear button would only show up if there are actual values selected.Starting with 16.7.1 the clear button would always show up, except if the FormControl value is set to
null
(instead of an empty array).Environment
Browser independent.
Behaviour discovered in one of our apps that uses the Diamond Template, but the StackBlitz reproducer proves, that this also happens outside of that app.
Reproducer
https://stackblitz.com/edit/github-avwzhm-4rytc3?file=src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.component.ts
Angular version
16.2.12
PrimeNG version
16.7.2
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.18.0
Browser(s)
All
Steps to reproduce the behavior
See reproducer.
Expected behavior
Empty array should be handled like null and the clear button should only be visible when at least one value is selected.
The text was updated successfully, but these errors were encountered: