reactour icon indicating copy to clipboard operation
reactour copied to clipboard

beforeClose firing on mount

Open zakpucci opened this issue 1 year ago • 3 comments

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?

zakpucci avatar Aug 06 '23 15:08 zakpucci

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!

elrumordelaluz avatar Aug 07 '23 10:08 elrumordelaluz

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.

texonidas avatar Sep 22 '23 04:09 texonidas

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.

Sekky61 avatar Apr 20 '24 16:04 Sekky61