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'm making a Flappybird clone where the bird is a poop and the tunnels are toilets and I use the useIntersect hook to detect when a toilet is on the screen to make sure those toilets that are already been passed are deleted.
So globally, I have an array of toilets that is frequently updated.
The problem is the callback sticks on the first array I init, because (I checked in the code) the useEffect is called only on the onMount.
three
version: 0.144.0@react-three/fiber
version: 8.7.1@react-three/drei
version: 9.26.1node
version: 16.17.0npm
(oryarn
) version: 8.15.0Problem description:
I'm making a Flappybird clone where the bird is a poop and the tunnels are toilets and I use the useIntersect hook to detect when a toilet is on the screen to make sure those toilets that are already been passed are deleted.
So globally, I have an array of toilets that is frequently updated.
The problem is the callback sticks on the first array I init, because (I checked in the code) the useEffect is called only on the onMount.
Relevant code:
I don't have a sandbox because the project is kind of huge and the problem is straightforward, but you can find the issue [here](https://github.com/fgarrec0397/flappy-poop/blob/SetupToilets/app/src/Features/Widgets/Toilets/components/ToiletColumn.tsx#:~:text=const%20ref%20%3D-,useIntersect,-((visible)
Suggested solution:
To fix the issue locally, I just overrided the useIntersect hook and add the
onChange
callback to theuseEffect
dependencies arrayThe text was updated successfully, but these errors were encountered: