-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
refactor(core): Use the early event contract instead of the event contract in the bootstrap. #55587
Conversation
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.
@iteriani I think there is some logic missing for the serialization phase: we'd need to exclude all mouse-related events (as that happens today in the EventContract
) and avoid including them into the contract even if those events were defined in a template. We may also need to do some additional processing (normalizing event names, etc) that happens today in the EventContract
.
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.
You may also want a test that shows that capture events do not work for EarlyEventContract.
packages/core/primitives/event-dispatch/src/earlyeventcontract.ts
Outdated
Show resolved
Hide resolved
packages/core/primitives/event-dispatch/src/earlyeventcontract.ts
Outdated
Show resolved
Hide resolved
packages/core/primitives/event-dispatch/src/earlyeventcontract.ts
Outdated
Show resolved
Hide resolved
43dc492
to
dc373b7
Compare
all comments resolved; capture tests have been added
5cac9cc
to
83f10ef
Compare
Should be available for review again |
1066be4
to
a6aae74
Compare
@iteriani could you please rebase this PR on top of the most recent |
…event types before adding them. In some cases, we will be passing in undefined for capture events, so handle this.
…t in bootstrap. This also fixes an existing bug where we erase the jsaction attribute too early. Now the event contract binary is 608 bytes :D.
…contract in bootstrap.
…contract in bootstrap.
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.
@iteriani thanks for addressing the feedback!
I've left a comment, but it's not blocking, we can do it in a followup PR (it may also require some changes from the JSAction side).
for (const eventType of events) { | ||
if ( | ||
eventType === 'mouseenter' || | ||
eventType === 'mouseleave' || | ||
eventType === 'pointerenter' || | ||
eventType === 'pointerleave' | ||
) { | ||
continue; | ||
} | ||
if ( | ||
eventType === 'focus' || | ||
eventType === 'blur' || | ||
eventType === 'error' || | ||
eventType === 'load' || | ||
eventType === 'toggle' | ||
) { | ||
captureEventTypes.push(eventType); |
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.
nit: just as an idea: we can have a couple helper functions from JSAction code, so that we can keep those lists in sync with how JSAction uses them internally.
for (const eventType of events) { | |
if ( | |
eventType === 'mouseenter' || | |
eventType === 'mouseleave' || | |
eventType === 'pointerenter' || | |
eventType === 'pointerleave' | |
) { | |
continue; | |
} | |
if ( | |
eventType === 'focus' || | |
eventType === 'blur' || | |
eventType === 'error' || | |
eventType === 'load' || | |
eventType === 'toggle' | |
) { | |
captureEventTypes.push(eventType); | |
for (const eventType of events) { | |
if (isMouseEvent(eventType) { | |
continue; | |
} | |
if (useCapturePhase(eventType)) { | |
captureEventTypes.push(eventType); |
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.
Reviewed-for: public-api
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.
reviewed-for: fw-core, primitives, fw-platform-server, public-api
@@ -54,9 +54,9 @@ | |||
}, | |||
"platform-server-hydration/browser": { | |||
"uncompressed": { | |||
"main": 200584, | |||
"main": 207890, |
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 confused why main jumped so much. I would have thought this only would impact the event-dispatch size. Any idea what's up there?
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.
we moved logic that was in the event contract to the main bundle.
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.
reviewed-for: size-tracking
TESTED=TGP |
This PR was merged into the repository by commit 28fb385. |
…t in bootstrap. (angular#55587) This also fixes an existing bug where we erase the jsaction attribute too early. Now the event contract binary is 608 bytes :D. PR Close angular#55587
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information