You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am modifying the isOpen state of a modal within a useEffect hook that has some redux states as a dependencies and I find that a modal remains open even though the isOpen state is set to false. When this occurs, I try to hide the modal by clicking my button that has the "hide" function tied to it many times, but it does not hide. I'm assuming that this is due to the fact that isOpen is already set to false and there is no state change when I click the button. I even added some "onChange" logging to verify and I found that both the onChange logging as well as the logging of the isOpen state show that the isOpen state is set to false even though the modal continues to show. I am wondering if this bug is caused due to me changing the visibility state rapidly within an useEffect hook and since the visibility might change a few times in quick succession? I debugged and saw that there is no loop or other continuous state modifications for the modal visibility going on.
An important note: I added a throttling mechanism for testing purposes which keeps all state updates in a queue, only allowing one state update be made every 500ms and it fixed the bug. Seems the issue is the rate of state updates?
There is a bunch of code in my component in which I saw this bug but here is all the relevant items to this bug:
This causes my the lower useEffect to trigger which update both "justDeletedAProject" state and "projects" redux state.
The update in states causes the upper useEffect to trigger, which manages the visibility of the Modal to be triggered which then causes a bug. As I mentioned in the description of the bug, for my testing I added some queueing mechanism to this useEffect to throttle the rate at which the visibility of the modal is being updated and it fixed the bug
I would also suspect if the visibility of a Modal is toggled multiple times in any other scenario, this would also reproduce the bug.
Expected behavior
Modal visibility behavior to match the isOpen state.
Screenshots or Videos
No response
Operating System Version
windows
Browser
Chrome
The text was updated successfully, but these errors were encountered:
I am facing a similar issue too with the latest version v2.7.5 where isOpen can sometimes be desynced with the actual modal behaviour. Here is minimal reproducible code:
The expected behaviour is that the modal should be closed. However by repeatedly refreshing the page, you will notice that the modal will remain open most of the time.
HeroUI Version
2.7.2
Describe the bug
I am modifying the isOpen state of a modal within a useEffect hook that has some redux states as a dependencies and I find that a modal remains open even though the isOpen state is set to false. When this occurs, I try to hide the modal by clicking my button that has the "hide" function tied to it many times, but it does not hide. I'm assuming that this is due to the fact that isOpen is already set to false and there is no state change when I click the button. I even added some "onChange" logging to verify and I found that both the onChange logging as well as the logging of the isOpen state show that the isOpen state is set to false even though the modal continues to show. I am wondering if this bug is caused due to me changing the visibility state rapidly within an useEffect hook and since the visibility might change a few times in quick succession? I debugged and saw that there is no loop or other continuous state modifications for the modal visibility going on.
An important note: I added a throttling mechanism for testing purposes which keeps all state updates in a queue, only allowing one state update be made every 500ms and it fixed the bug. Seems the issue is the rate of state updates?
There is a bunch of code in my component in which I saw this bug but here is all the relevant items to this bug:
My NextUIModal component:
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
I would also suspect if the visibility of a Modal is toggled multiple times in any other scenario, this would also reproduce the bug.
Expected behavior
Modal visibility behavior to match the isOpen state.
Screenshots or Videos
No response
Operating System Version
windows
Browser
Chrome
The text was updated successfully, but these errors were encountered: