FormidableLabs / react-swipeable

React swipe event handler hook
https://commerce.nearform.com/open-source/react-swipeable
MIT License
2k stars 147 forks source link

Duplicated eventlistener? #229

Closed ash0080 closed 2 years ago

ash0080 commented 3 years ago

Describe the bug duplicated

Steps or Sandbox to reproduce open your app in browser, switch to another tab(browser tabs) then back, ( or wait a few minutes ) It looks like hook re-add another eventListener (duplicated) switch and back... 3. then 4

Expected behavior The current cleanup policy seems does not work 100% of the time

Device/Browser chrome, safari, ios safari

Passive or active mode are the same

My code is almost identical to the example, except that I used preact and styled component

hartzis commented 3 years ago

@ash0080 Thank you for submitting the issue. This is a very intriguing bug and I'd love to help dig into replicating and fixing it.

When you say "almost identical to the example" do you mean the codesandbox.io example here?

If so i'm unable to replicate what you're seeing by waiting and switching between tabs with the above codesandbox example.

Could you share your codesandbox that you've created and I'll see if i can replicate it with your example?

hartzis commented 2 years ago

closing for now, please re-open if we can get an example 😸