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

ConfirmDialog and ConfirmPopup: onHide event bug #3197

Closed
btudorache opened this issue Aug 27, 2022 · 3 comments · Fixed by #3198
Closed

ConfirmDialog and ConfirmPopup: onHide event bug #3197

btudorache opened this issue Aug 27, 2022 · 3 comments · Fixed by #3198
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@btudorache
Copy link

btudorache commented Aug 27, 2022

Describe the bug

The onHide event of the ConfirmDialog and ConfirmPopup components expects a function with a parameter of type result?: string, but the actual type is result?: (string | undefined)[]. The result string is wrapped in an array. Also, the onHide event triggers twice every time the popup or the dialog is confirmed/rejected/skipped.

Reproducer

https://codesandbox.io/s/hardcore-sara-36ed95

PrimeReact version

8.4.0

React version

18.x

Language

ALL

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Open the sandbox
  2. Click the button to activate the pop-up or the dialog
  3. You can see on the console output that the event is triggered twice, and the logged "result" parameter prints as an array with a string or undefined inside

Expected behavior

The "result" parameter of the onHide event should be truly a string or undefined, and the event should trigger only once.

@btudorache btudorache added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 27, 2022
melloware added a commit to melloware/primereact that referenced this issue Aug 27, 2022
@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 Aug 27, 2022
@melloware melloware self-assigned this Aug 27, 2022
@melloware melloware added the Core Team Issue or pull request has been *opened* by a member of Core Team label Aug 27, 2022
@melloware melloware added this to the 8.5.0 milestone Aug 27, 2022
@melloware
Copy link
Member

Excellent reproducer and report. See my PR.

@btudorache
Copy link
Author

Looks great to me

@mertsincan mertsincan removed the Core Team Issue or pull request has been *opened* by a member of Core Team label Aug 29, 2022
@ryan-ju
Copy link

ryan-ju commented Dec 11, 2024

@melloware I think the typing isn't fixed. The doc still says result: string.

https://primereact.org/confirmdialog/

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.

4 participants