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

p-dropdown: FormControl loses value if it contains a value not in options and options array is updated #11645

Closed
leendertdommicent opened this issue Jun 22, 2022 · 1 comment · Fixed by #11813
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@leendertdommicent
Copy link

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

  1. Click on refresh.

Expected behavior

Control remains having it's value as before and the required validator is not triggered.

Hapcy pushed a commit to Hapcy/primeng that referenced this issue Aug 10, 2022
@cetincakiroglu cetincakiroglu added this to the 14.0.3 milestone Sep 9, 2022
cetincakiroglu added a commit that referenced this issue Sep 9, 2022
…ons-fix

Fix #11645: don't clear value if editable dropdown's value is not in …
@cetincakiroglu cetincakiroglu added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Sep 13, 2022
@GlennTq
Copy link

GlennTq commented Oct 17, 2022

Will this also be solved in version 13? If yes, which exact version should I use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants