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): Rename BaseDispatcher to Dispatcher. #55721

Closed

Conversation

tbondwilkinson
Copy link
Contributor

Rename BaseDispatcher to Dispatcher and Dispatcher to LegacyDispatcher. The GlobalHandler type needs to be left for now in dispatcher.ts as it was not exported previously from legacy_dispatcher.ts.

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:

@tbondwilkinson tbondwilkinson force-pushed the jsaction-action-resolver branch 3 times, most recently from 476051f to cdcbe6b Compare May 8, 2024 18:42
@tbondwilkinson
Copy link
Contributor Author

TESTED=TGP

@tbondwilkinson tbondwilkinson marked this pull request as ready for review May 9, 2024 19:17
@pullapprove pullapprove bot requested review from alxhub and ellenyuan May 9, 2024 19:18
@pullapprove pullapprove bot added the requires: TGP This PR requires a passing TGP before merging is allowed label May 9, 2024
@tbondwilkinson tbondwilkinson requested review from rahatarmanahmed and AndrewKushnir and removed request for alxhub and ellenyuan May 9, 2024 19:18
@tbondwilkinson tbondwilkinson added area: core Issues related to the framework runtime target: rc This PR is targeted for the next release-candidate core: event dispatch labels May 9, 2024
@ngbot ngbot bot modified the milestone: Backlog May 9, 2024
@tbondwilkinson tbondwilkinson added the action: review The PR is still awaiting reviews from at least one requested reviewer label May 9, 2024
goldens/public-api/core/primitives/event-dispatch/index.md Outdated Show resolved Hide resolved
packages/core/primitives/event-dispatch/README.md Outdated Show resolved Hide resolved
packages/core/primitives/event-dispatch/src/dispatcher.ts Outdated Show resolved Hide resolved
setEventReplayer(eventReplayer: Replayer) {
this.eventReplayer = eventReplayer;
this.eventReplayScheduled = true;
Promise.resolve().then(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why do we replay in a microtask? Would it make sense to add a comment here?

I was also thinking if we can use queueMicrotask here instead. The code is pre-existing, so we can handle it in a separate PR (so that this PR retains an existing logic).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

queueMicrotask is not yet in CDW tier1, https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask

This microtask logic predates our efforts here, I suspect we can get rid of it, but it has a high risk of rollback due to being a breaking timing change, so we'd want to let that simmer as a single change PR, perhaps even with a easy rollback mechanism.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This microtask logic predates our efforts here, I suspect we can get rid of it

Thanks for additional info. I'm not proposing to remove it, just curious why we do it. If we have any info - we can add as a comment to the code, if we don't have this info (and it's there for historical reason) - we can add a comment later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only information I have is that comment - that it "emulates" browser behavior. I suspect this is more to do with the legacy behavior of the dispatcher, which is to schedule event replay whenever a new handler is registered. We can preserve that behavior in the LegacyDispatcher though.

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 thePunderWoman May 12, 2024 02:44
Copy link
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Reviewed-for: public-api

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, public-api

@tbondwilkinson tbondwilkinson removed the request for review from dylhunn May 13, 2024 17:22
@tbondwilkinson tbondwilkinson 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 13, 2024
@ngbot
Copy link

ngbot bot commented May 13, 2024

I see that you just added the action: merge label, but the following checks are still failing:
    failure conflicts with base branch "main"

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

Rename `BaseDispatcher` to `Dispatcher` and `Dispatcher` to
`LegacyDispatcher`. The `GlobalHandler` type and `stopPropagation`
function needs to be left for now in dispatcher.ts as it was not
exported previously from legacy_dispatcher.ts.
@atscott
Copy link
Contributor

atscott commented May 13, 2024

This PR was merged into the repository by commit 0cb5031.

atscott pushed a commit that referenced this pull request May 13, 2024
Rename `BaseDispatcher` to `Dispatcher` and `Dispatcher` to
`LegacyDispatcher`. The `GlobalHandler` type and `stopPropagation`
function needs to be left for now in dispatcher.ts as it was not
exported previously from legacy_dispatcher.ts.

PR Close #55721
@atscott atscott closed this in 0cb5031 May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime core: event dispatch 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