Skip to content

Conversation

agale123
Copy link
Contributor

@agale123 agale123 commented Aug 7, 2019

… emitting AngularJS events

The $locationShim has onChange listeners to allow for synchronization logic between
AngularJS and Angular. When the AngularJS routing events are emitted first, this can
cause Angular code to be out of sync. Notifying the listeners earlier solves the
problem.

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?

Listeners to the $locationShim onChange are notified after the $locationChangeSuccess or $locationChangeStart events.

Issue Number: N/A

What is the new behavior?

Listeners to the $locationShim onChange are notified immediately before the $locationChangeSuccess or $locationChangeStart events.

Does this PR introduce a breaking change?

  • Yes
  • No

If someone is already using this method and depending on the existing ordering of events then technically this could be breaking. But the contract for the onChange method doesn't make any guarentees about the ordering of these events, it just says that the listeners are notified.

Other information

See b/138246666 for more details on the Google internal bug causing this change.

… emitting AngularJS events

The $locationShim has onChange listeners to allow for synchronization logic between
AngularJS and Angular. When the AngularJS routing events are emitted first, this can
cause Angular code to be out of sync. Notifying the listeners earlier solves the
problem.
@agale123 agale123 requested a review from a team as a code owner August 7, 2019 14:00
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me. Thanks @agale123

@alxhub alxhub added the area: common Issues related to APIs in the @angular/common package label Aug 8, 2019
@ngbot ngbot bot added this to the needsTriage milestone Aug 8, 2019
@kara kara added action: presubmit The PR is in need of a google3 presubmit target: major This PR is targeted for the next major release labels Aug 12, 2019
@agale123
Copy link
Contributor Author

@kara kara added action: merge The PR is ready for merge by the caretaker and removed action: presubmit The PR is in need of a google3 presubmit labels Aug 13, 2019
@kara kara closed this in 5064dc7 Aug 13, 2019
sabeersulaiman pushed a commit to sabeersulaiman/angular that referenced this pull request Sep 6, 2019
… emitting AngularJS events (angular#32037)

The $locationShim has onChange listeners to allow for synchronization logic between
AngularJS and Angular. When the AngularJS routing events are emitted first, this can
cause Angular code to be out of sync. Notifying the listeners earlier solves the
problem.

PR Close angular#32037
@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 Sep 15, 2019
@agale123 agale123 deleted the location-branch branch October 2, 2019 12:58
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: common Issues related to APIs in the @angular/common package cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants