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

Dropdown: Triggers 3 onChange events when rendered (two empty) #14136

Closed
mher-at-qbeyond opened this issue Nov 16, 2023 · 0 comments
Closed

Dropdown: Triggers 3 onChange events when rendered (two empty) #14136

mher-at-qbeyond opened this issue Nov 16, 2023 · 0 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@mher-at-qbeyond
Copy link

Describe the bug

If the dropdown is configured with the following properties, it will launch 3 onChange events.
Events received:

  1. With the value of the first item of the list as if selected
  2. With undefined originalEvent and null value
  3. With undefined originalEvent and undefined value

Configuration of the component:

    [options]="cities"
    [(ngModel)]="selectedCity"
    optionLabel="name"
    showClear="true"
    placeholder="Select a City"
    (onChange)="dropdownChanged($event);"

Environment

Angular: 16.2.7
PrimeNG: 16.7.2
Browser: latest Chrome

Reproducer

https://stackblitz.com/edit/g7rjd1-mfrw5d

Angular version

16.2.7

PrimeNG version

16.7.2

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

16.20.2

Browser(s)

No response

Steps to reproduce the behavior

  1. Configure the dropdown as seen above
  2. After the page is rendered three events will be launched on onChange trigger

Expected behavior

Should not launch three onChange events when rendered. The first item marking as selected in the initial event should not happen.

@mher-at-qbeyond mher-at-qbeyond 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 16, 2023
@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 Nov 16, 2023
@cetincakiroglu cetincakiroglu added this to the 16.8.0 milestone Nov 16, 2023
@cetincakiroglu cetincakiroglu self-assigned this Nov 16, 2023
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

No branches or pull requests

2 participants