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

fix(PointerLockControls): Changed addEventListener to removeEventListener on unmount #1703

Merged

Conversation

mynameisgump
Copy link
Contributor

@mynameisgump mynameisgump commented Nov 6, 2023

Why

<PointerLockControls> were adding events on unmount instead of removing them. I noticed it since I was using a state to conditionally render the component, and the _listeners prop was showing more items being added to the array

What

Changed the addEventListeners on unmount to removeEventListeners in the PointerLockControls.tsx component.

Checklist

  • Ready to be merged

Copy link

vercel bot commented Nov 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drei ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2023 2:24am

@mynameisgump mynameisgump changed the title fix: Changed addEventListener to removeEventListener on unmount fix(PointerLockControls): Changed addEventListener to removeEventListener on unmount Nov 6, 2023
Copy link

codesandbox-ci bot commented Nov 6, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4440774:

Sandbox Source
prod-bash-dk4wq4 Configuration
Ground reflections and video textures Configuration
arc-x-pmndrs-colors Configuration

@CodyJasonBennett CodyJasonBennett merged commit 7bf7bf6 into pmndrs:master Nov 10, 2023
2 checks passed
Copy link

🎉 This PR is included in version 9.88.13 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants