-
Notifications
You must be signed in to change notification settings - Fork 47.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
Flare: Fix listener upgrade bug #18270
Conversation
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 db1f226:
|
Details of bundled changes.Comparing: 2953425...db1f226 react-dom
ReactDOM: size: 0.0%, gzip: -0.0% Size changes (experimental) |
Details of bundled changes.Comparing: 2953425...db1f226 react-dom
ReactDOM: size: 0.0%, gzip: -0.0% Size changes (stable) |
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.
stamping to unblock, but maybe you should get another pair of eyes on this.
Flare: fix bug with event upgrading Fix Fix
51fcc95
to
db1f226
Compare
topLevelType: string, | ||
listener: any => void, | ||
) { | ||
if (listener.remove != null) { |
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.
This is not great because we're shipping this code even if it's not an FB listener. Like if Function.prototype.remove is added on the page. It also confuses the compiler. We should be sure which path we're using and consistently call that - statically
passive: true, | ||
}); | ||
} else { | ||
document.removeEventListener(topLevelType, listener, true); |
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.
This isn't going through the forked indirection which isn't the right layering. This whole function should all be moved to EventListener.js. That way it can be properly forked and you can statically choose which function to call.
This fixes a bug that was found internally when attempting to upgrade to an active event listener. We weren't properly removing the passive event listener. Also wired up logic for fb event listeners so we correctly remove those too.