Skip to content

feat(common): add getState method to LocationStrategy interface#45648

Closed
mmaterowski wants to merge 1 commit intoangular:masterfrom
mmaterowski:location-strategy-api
Closed

feat(common): add getState method to LocationStrategy interface#45648
mmaterowski wants to merge 1 commit intoangular:masterfrom
mmaterowski:location-strategy-api

Conversation

@mmaterowski
Copy link
Contributor

Add getState to LocationStrategy interface as it suppose to be the place to control all window.location interactions

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: #34603

What is the new behavior?

LocationStrategy implements getState() method which will eventually call window.history to access current history state.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Only classes that implement Abstract LocationStrategy are PathLocationStrategy (test already present) and HashLocationStrategy. Currently there are no tests for HashLocationStrategy, if you find them necessary for this PR to merge let me know.

@pullapprove pullapprove bot requested a review from dylhunn April 15, 2022 08:12
@mmaterowski
Copy link
Contributor Author

I'm having trouble understating how my change is failing following test

styling should set class based on priority in styling_spec.ts

Seems to work locally when I execute
KARMA_WEB_TEST_MODE=SL_REQUIRED yarn karma start ./karma-js.conf.js --single-run
Result:
image

@atscott atscott added area: common Issues related to APIs in the @angular/common package breaking changes flag: breaking change labels Apr 15, 2022
@ngbot ngbot bot modified the milestone: Backlog Apr 15, 2022
Copy link
Contributor

@atscott atscott left a comment

Choose a reason for hiding this comment

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

@mmaterowski Thanks for the PR. This does not fully address #34603 because Location still uses PlatformLocation directly rather than going through the new API you're providing here.

In addition, you'll have to note in the commit message that this is a breaking change (add BREAKING CHANGE: <description> to your footer) because it adds a new required class member that any implementors of the LocationStrategy will need to satisfy.

@mmaterowski mmaterowski force-pushed the location-strategy-api branch from 8ae2aaf to 1153241 Compare April 15, 2022 17:16
@atscott
Copy link
Contributor

atscott commented Apr 15, 2022

I'm having trouble understating how my change is failing following test

Yea, there is known flakiness with a few tests at the moment. Sorry about the friction.

Adds getState to LocationStrategy interface as it suppose to be the place to control all window.location interactions.

BREAKING CHANGE:
Adds new required class member that any implementors of the LocationStrategy will need to satisfy.
Location does not depend on PlatformLocation anymore.
@mmaterowski mmaterowski force-pushed the location-strategy-api branch from 1153241 to ef91df6 Compare April 15, 2022 17:39
@mmaterowski
Copy link
Contributor Author

@atscott thanks for reviewing my PR.
Since PlatformLocation is no longer used in Location I removed it from Location's constructor.
Breaking changes footer added.

Copy link
Contributor

@atscott atscott left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@atscott atscott added the action: presubmit The PR is in need of a google3 presubmit label Apr 15, 2022
Copy link
Contributor

@jessicajaniuk jessicajaniuk 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 alxhub April 15, 2022 17:45
Copy link
Contributor

@atscott atscott 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 AndrewKushnir April 15, 2022 17:50
@atscott
Copy link
Contributor

atscott commented Apr 15, 2022

Note for team members: Since this is a breaking change, I've triggered global presubmits to identify what needs to be updated.

Also adding the blocked label until they necessary internal cleanup has been completed.

Copy link
Contributor

@dylhunn dylhunn 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

@dylhunn
Copy link
Contributor

dylhunn commented Apr 15, 2022

@atscott by internal cleanup, do you mean TGP breakage? The linked presubmit is not showing any real failures.

@atscott
Copy link
Contributor

atscott commented Apr 15, 2022

@dylhunn The TGP isn't finished (the full train runs don't show up in the UI until they are; only the smoke test is available immediately). From prior work in this area, I know there will be failures that need to be fixed.

@dylhunn
Copy link
Contributor

dylhunn commented Apr 15, 2022

only the smoke test is available immediately

Thanks for clarifying!

@atscott atscott added action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release and removed action: presubmit The PR is in need of a google3 presubmit labels Apr 21, 2022
@ngbot
Copy link

ngbot bot commented Apr 21, 2022

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google3" is failing
    pending 3 pending code reviews

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 master, please try rebasing to master 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.

@atscott atscott added action: global presubmit The PR is in need of a google3 global presubmit and removed action: merge The PR is ready for merge by the caretaker labels Apr 21, 2022
@atscott
Copy link
Contributor

atscott commented Apr 21, 2022

Internal cleanup is finished. Started a new global presubmit to ensure there weren't any regressions. Then this should be good to go today or tomorrow.

@atscott atscott added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Apr 22, 2022
@atscott
Copy link
Contributor

atscott commented Apr 22, 2022

merge assistance: requires internal patch when syncing: http://cl/443689787

@atscott
Copy link
Contributor

atscott commented Apr 25, 2022

This PR was merged into the repository by commit 31d7c3b.

@atscott atscott closed this in 31d7c3b Apr 25, 2022
@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 May 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: global presubmit The PR is in need of a google3 global presubmit action: merge The PR is ready for merge by the caretaker area: common Issues related to APIs in the @angular/common package breaking changes merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants