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

RadioButton: onChange is being triggered twice. #6223

Closed
srikanth-nallamothu opened this issue Mar 25, 2024 · 0 comments · Fixed by #6224
Closed

RadioButton: onChange is being triggered twice. #6223

srikanth-nallamothu opened this issue Mar 25, 2024 · 0 comments · Fixed by #6224
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@srikanth-nallamothu
Copy link

srikanth-nallamothu commented Mar 25, 2024

Describe the bug

OnChange on RadioButton component event is being triggered twice, and I see that logic in RadioButton.js here https://github.com/primefaces/primereact/blob/master/components/lib/radiobutton/RadioButton.js#L60 and https://github.com/primefaces/primereact/blob/master/components/lib/radiobutton/RadioButton.js#L68 it's being called twice

We should only trigger onChange only once.

Reproducer

https://stackblitz.com/edit/ugdbqe?file=src%2FApp.jsx

PrimeReact version

10.5.3

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

Any

Steps to reproduce the behavior

Click on the checkbox above, you should see TWO alerts on change.

Expected behavior

It should only show alert once on change of radio button.

@srikanth-nallamothu srikanth-nallamothu added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 25, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Mar 25, 2024
@melloware melloware self-assigned this Mar 25, 2024
@melloware melloware added this to the 10.6.0 milestone Mar 25, 2024
nitrogenous added a commit that referenced this issue Mar 26, 2024
Fix #6223: RadioButton onChange called twice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants