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: REGRESSION a value of null or '' was previously treated as valid dropdown values, now it looks like they are treated as undefined #14223

Closed
pete-mcwilliams opened this issue Nov 28, 2023 · 1 comment · Fixed by #14225
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@pete-mcwilliams
Copy link
Contributor

Describe the bug

As they are being treated as undefined selecting one in a dropdown when using optionValue leads to the dropdown going to empty state rather than matching the options list.

working version "primeng": "16.4.2",
https://stackblitz.com/edit/zkmdqg-3jfond?file=src%2Fapp%2Fdemo%2Fdropdown-template-demo.html,src%2Fapp%2Fdemo%2Fdropdown-template-demo.ts

same code version bumped to 16.9.1 (still an issue in the 17 beta also)
https://stackblitz.com/edit/zkmdqg-uvtidd?file=src%2Fapp%2Fdemo%2Fdropdown-template-demo.html,src%2Fapp%2Fdemo%2Fdropdown-template-demo.ts

Environment

see repro

Reproducer

https://stackblitz.com/edit/zkmdqg-uvtidd?file=src%2Fapp%2Fdemo%2Fdropdown-template-demo.html,src%2Fapp%2Fdemo%2Fdropdown-template-demo.ts

Angular version

16.2.7

PrimeNG version

16.8.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

v18.17.0

Browser(s)

n/a

Steps to reproduce the behavior

use dropdown with options which include code with null or '' and using optionValue
this.options = [ { name: 'Null code', code: null }, { name: 'Empty code', code: '' }, ];

Expected behavior

the option label should display when null or empty string are options as it did previously.

@pete-mcwilliams pete-mcwilliams added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 28, 2023
pete-mcwilliams added a commit to pete-mcwilliams/primeng that referenced this issue Nov 28, 2023
pete-mcwilliams added a commit to pete-mcwilliams/primeng that referenced this issue Nov 28, 2023
pete-mcwilliams added a commit to pete-mcwilliams/primeng that referenced this issue Nov 28, 2023
pete-mcwilliams added a commit to pete-mcwilliams/primeng that referenced this issue Nov 28, 2023
pete-mcwilliams added a commit to pete-mcwilliams/primeng that referenced this issue Nov 28, 2023
pete-mcwilliams added a commit to pete-mcwilliams/primeng that referenced this issue Nov 28, 2023
@djay1977
Copy link

Would it be possible to add this fix in a 16.9.2 patch? Not on version 17

@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Dec 6, 2023
@cetincakiroglu cetincakiroglu added this to the 17.0.0 milestone Dec 6, 2023
cetincakiroglu added a commit that referenced this issue Dec 6, 2023
fix for option values of null and empty string (#14223)
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