-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
Don't use EventListener Fork in Modern WWW Builds #18333
Conversation
That way we can statically compile out more of these indirections.
if (passiveBrowserEventsSupported) { | ||
targetContainer.removeEventListener(rawEventName, listener, { | ||
capture, | ||
passive, |
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 passive flag is not needed when removing. Only the capture flag needs to be specified.
validTargetContainer.removeEventListener( | ||
((rawEventName: any): string), | ||
(listener: any), | ||
); |
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 wasn't specifying the capture flag but I fixed that.
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 fdf0b23:
|
Details of bundled changes.Comparing: aae83a4...fdf0b23 react-dom
Size changes (experimental) |
Details of bundled changes.Comparing: aae83a4...fdf0b23 react-dom
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.
Thanks for doing this. It looks great to me.
@@ -259,20 +250,9 @@ export function removeTrappedEventListener( | |||
capture: boolean, | |||
listener: any => void, | |||
passive: void | boolean, |
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 argument is not used anymore, I'll address in #18336.
I'm merging this as it feeds into #18336. :) |
If D20382065 successfully rolls out (has some issues still). Then we don't need this fork anymore.
We should start by at least removing it from Modern builds.
To do this I needed to fix the unsubscribing stuff mentioned in #18270 (comment). Flare is now used by both the FB fork and without it so we should just compile to one or the other. I do that by always returning an unsubscribe listener and always passing that to a removeEventListener function. The indirections can then be compiled out.