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

refactor(core): Use the early event contract instead of the event contract in the bootstrap. #55587

Closed
wants to merge 13 commits into from

Conversation

iteriani
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove bot added the requires: TGP This PR requires a passing TGP before merging is allowed label Apr 30, 2024
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a 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.

@thePunderWoman thePunderWoman added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: rc This PR is targeted for the next release-candidate labels Apr 30, 2024
@ngbot ngbot bot modified the milestone: Backlog Apr 30, 2024
Copy link
Contributor

@tbondwilkinson tbondwilkinson left a 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.

@iteriani iteriani force-pushed the eventcontractbinary2 branch 2 times, most recently from 43dc492 to dc373b7 Compare April 30, 2024 22:24
@iteriani iteriani dismissed tbondwilkinson’s stale review April 30, 2024 22:25

all comments resolved; capture tests have been added

@iteriani iteriani force-pushed the eventcontractbinary2 branch 5 times, most recently from 5cac9cc to 83f10ef Compare May 6, 2024 20:21
@iteriani
Copy link
Contributor Author

iteriani commented May 6, 2024

Should be available for review again

@AndrewKushnir
Copy link
Contributor

@iteriani could you please rebase this PR on top of the most recent main branch? We've merged PR #55708 (comment), which adds size-tracking to the event contract script and it'd likely decrease a lot (which is great!) with the changes from this PR. Once you rebase and push the changes, we'll see what CI says and we can update the size-trackingaccordingly.

…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.
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a 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).

Comment on lines +147 to +163
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);
Copy link
Contributor

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.

Suggested change
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);

Copy link
Contributor

@AndrewKushnir AndrewKushnir left a 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

@pullapprove pullapprove bot requested a review from atscott May 7, 2024 23:02
Copy link
Contributor

@thePunderWoman thePunderWoman left a 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

@iteriani iteriani removed request for atscott and alxhub May 8, 2024 16:15
@iteriani
Copy link
Contributor Author

iteriani commented May 8, 2024

TGP

@iteriani iteriani added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels May 8, 2024
@@ -54,9 +54,9 @@
},
"platform-server-hydration/browser": {
"uncompressed": {
"main": 200584,
"main": 207890,
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@pullapprove pullapprove bot requested a review from thePunderWoman May 8, 2024 16:29
Copy link
Contributor

@thePunderWoman thePunderWoman left a 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

@thePunderWoman thePunderWoman removed the request for review from alxhub May 8, 2024 16:41
@iteriani
Copy link
Contributor Author

iteriani commented May 8, 2024

TESTED=TGP

@atscott
Copy link
Contributor

atscott commented May 9, 2024

This PR was merged into the repository by commit 28fb385.

atscott pushed a commit that referenced this pull request May 9, 2024
…event types before adding them. (#55587)

In some cases, we will be passing in undefined for capture events, so handle this.

PR Close #55587
atscott pushed a commit that referenced this pull request May 9, 2024
…t in bootstrap. (#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 #55587
@atscott atscott closed this in f5b6b7f May 9, 2024
atscott pushed a commit that referenced this pull request May 9, 2024
…t in bootstrap. (#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 #55587
tbondwilkinson pushed a commit to tbondwilkinson/angular that referenced this pull request May 9, 2024
…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
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime requires: TGP This PR requires a passing TGP before merging is allowed target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants