-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Dialog component misfires onHide
function
#880
Comments
Have you found a solution ? I have the same problem , I also reverted the version back to primereact^3.1.2 but the bug was still unresolved |
I haven't encountered this as I avoid the use of the visible prop as even if visible is false the dialog is rendered. So if the visible prop should be false just don't render the dialog. Problem with this solution is you loose the nice CSS transition when opening the dialog. |
Seems that is a side effect of #854 Proposed solution for first problem.
Or the other solution would be to make your onHide method rate-limited, with some sort of wrapper like this:
|
This is an expected behavior. Before the Dialog is closed, most users want to have a callback like onHide to use for different purposes. On your issue, you need to check this.state.visible to do setState or another thing;
|
I'm submitting a ... (check one with "x")
Steps to reproduce
Go to: https://codesandbox.io/s/50v0m27wol
Show
Yes
,No
, or the close icon.onHide()
is called twice, instead of once.Current behavior
onHide
method fires whenever modalvisible
property is changed.Expected behavior
onHide
should only fire whenclose
icon is selected.React version:
react ^16.8.4
PrimeReact version:
This only started to occur in primereact^3.1.3, I even reverted the version back to primereact^3.1.2 and the bug was resolved.
Browsers
Chrome Version 74.0.3729.131 (Official Build) (64-bit)
Brave Version 0.63.48 Chromium: 74.0.3729.108 (Official Build) (64-bit)
The text was updated successfully, but these errors were encountered: