p-dropdown: FormControl loses value if it contains a value not in options and options array is updated #11645
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
This issues occurs in an editable dropdown field which contains a value that is not in the options of the dropdown. When this is the case and the options array is updated, the control behind the dropdown loses its value. If you type something new in the dropdown, it works again.
The stackblitz below sets the value of the control on an arbitrary value, if you then press refresh, the options array is updated and the problem occurs. The field goes in error since it is required but the FormControl behind it does not contain a value anymore.
This seems to happen since version 13.4.0.
Environment
Angular SPA running in an Azure App Service.
Reproducer
https://stackblitz.com/edit/primeng-dropdown-demo-szuvjj?file=src/app/app.component.ts
Angular version
13.0.3
PrimeNG version
13.4.1
Build / Runtime
TypeScript
Language
TypeScript
Node version (for AoT issues node --version)
16.15.1
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
Control remains having it's value as before and the required validator is not triggered.
The text was updated successfully, but these errors were encountered: