fabe/gatsby-universal

Interaction observer does not work correctly when added to multiple pages

pfortes opened this issue · 0 comments

The interaction observer component stops working if it exists in two different pages and you navigate directly from one to the other.

i created a test in codesandbox that adds the IO-Example component to the about page, there you can see that if you refresh any of the pages it works but if you navigate from one to the other the interaction is not registered.

https://codesandbox.io/s/gatsby-universal-smyvs

Edit: I ended up using the useInView hook from https://github.com/thebuilder/react-intersection-observer and it works great.