-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Clear event listeners on unmount in Tooltip component #32729
Conversation
Size Change: +5 B (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this before/after and the console warning is no longer present in this PR 🎉
@@ -168,6 +168,7 @@ function Tooltip( { children, position, text, shortcut } ) { | |||
}; | |||
const clearOnUnmount = () => { | |||
delayedSetIsOver.cancel(); | |||
document.removeEventListener( 'mouseup', cancelIsMouseDown ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting eslint warnings about us not using ownerDocument
here. Maybe one for a followup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attached event is using document
already, so yeah probably a followup, and not related to this PR.
Description
Partially address #31907.
The
<Tooltip>
component is not cleaning up event listeners correctly when unmounting.How has this been tested?
Follow the first part of the reproduction steps in #31907.
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).