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

beforeClose firing on mount #582

Open
zakpucci opened this issue Aug 6, 2023 · 3 comments
Open

beforeClose firing on mount #582

zakpucci opened this issue Aug 6, 2023 · 3 comments

Comments

@zakpucci
Copy link

zakpucci commented Aug 6, 2023

My assumption would be that the beforeClose event on the TourProvider would fire on mousedown on the close button. I'm seeing this event fire on mount if I call setIsOpen. Any know issues here? Am I missing something?

@elrumordelaluz
Copy link
Owner

Hi @zakpucci, thanks for open the Issue.

Sound weird. Mind creating a minimal reproduction in a sandbox in order to allow others to debug your use-case and try to find a solution? Thanks!

@texonidas
Copy link

I've run into this. You have your react in strict mode, which means all useEffects are run, then cleanup, then run again (basically a mount/remount). This is to ensure your side effects are clean. There is no way to disable it for portions of your application, so you will have to remove it entirely.

@Sekky61
Copy link

Sekky61 commented Apr 20, 2024

Just ran into this. Would it be worth it to implement beforeClose differently?

Maybe add some behavior to setIsOpen(false)? The mounting of <Tour> is dependant on isOpen after all.
The only problem I see there is if the whole TourProvider is unmounted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants