Repository navigation
feat(common): add historyGo method to Location service - #38890
aahmedayed wants to merge 1 commit into
Conversation
atscott
left a comment
There was a problem hiding this comment.
Hi @aahmedayed, thanks for the PR - I think this is a good change overall, just a few items to address.
- Add some tests to
location_spec.tsto validate the behavior of this new method - Please update the spelling of "methode" and "methodes" in the commit message to be "method" and "methods" and add a link to the history API documentation for
History#go.
|
Hi @atscott - Thanks for the review, i'll start working on it. |
|
Hi @atscott - I've made the adjustments required. |
3ed86c0 to
8e474e7
Compare
atscott
left a comment
There was a problem hiding this comment.
Great work on updating the mock_platform_location! Just a couple more small requests for testing scenarios so we have sufficient coverage.
|
Thank you @atscott, i'm working on it. |
e110e2a to
365794f
Compare
|
@atscott - I’ve already finished the adjustments you asked for. |
atscott
left a comment
There was a problem hiding this comment.
LGTM after the fixup of the integration.spec.ts test. Adding approval to allow this to move forward for public API review.
|
@aahmedayed The CI tests are failing to execute because you may have set up circleci on your fork, but don't have permission to run this level of resource class. Could you please disable CircleCI on your angular fork? |
365794f to
16819c8
Compare
|
You can preview 365737b at https://pr38890-365737b.ngbuilds.io/. |
IgorMinar
left a comment
There was a problem hiding this comment.
Hi there, thanks for the PR.
I discussed this with @atscott a bit and I raised two things:
-
this looks like a speculative API that might or might not end up being used in router to fix #13586 - I'd prefer if we waited for us to solidify that fix and go forward with this API change only if its needed for that fix. The primary reason for this is that the api is not generally useful for applications. And in the case that our router doesn't end up using it, it would be just an extra clutter and additional bytes we need to download to the client within the critical path.
-
could you consider extending the existing
back()andforward()apis by allowing them to accept a number parameter e.g.back(steps: number)/forward(steps: number). The valid parameter value could be a positive integer, or we could support any integer as long as it's within bounds of the current navigation stack (negative values would causebackmethod to behave as if it were theforwardcall.
I don't feel strongly about my api name change proposal, but whenever possible I prefer extending existing APIs rather than creating new ones.
|
Thank you @IgorMinar for the review, yes i think we'd rather wait to solidify that fix. |
365737b to
81d646a
Compare
|
public API reviewers, PTAL. Following the discussion in the FW sync today, this change has been made non-breaking by having the new functions be optional. This opens the door to fixing #13586. In addition, discussions in WICG/navigation-api#32 confirm that the current standard practice for correctly restoring state after a rejected navigation is to use the |
|
You can preview 81d646a at https://pr38890-81d646a.ngbuilds.io/. |
81d646a to
9100b03
Compare
|
You can preview 9100b03 at https://pr38890-9100b03.ngbuilds.io/. |
|
@atscott quick question: the |
|
@AndrewKushnir Yes, this will be used in the router code in follow-up PRs. The router does not currently do any verification on similar methods that are not implemented in subclasses (or their underlying |
|
Thanks for additional information @atscott. The scenario I was thinking of is:
I believe the 3rd step might be a breaking change, but it'd be a part of the followup PR, so this PR should be good to go (and the followup PR would be marked as breaking change). Please let me know if my understanding is correct or the above mentioned scenario is not a valid one. Thank you. |
|
@AndrewKushnir - Yes, the change in the router would need to be marked as a breaking change if we made it the default and/or did not make it an opt-in option. It would also be breaking for another reason: even though it would fix currently broken behavior, developers have implemented workarounds for it which would then be incompatible/unnecessary with the |
Add new method `historyGo`, that will let the user navigate to a specific page from session history identified by its relative position to the current page. We add some tests to `location_spec.ts` to validate the behavior of the `historyGo` and `forward` methods. Add more tests for `location_spec` to test `location.historyGo(0)`, `location.historyGo()`, `location.historyGo(100)` and `location.historyGo(-100)`. We also add new tests for `Integration` spec to validate the navigation when we using `location#historyGo`. Update the `historyGo` function docs Note that this was made an optional function in the abstract classes to avoid a breaking change. Because our location classes use `implements PlatformLocation` rather than `extends PlatformLocation`, simply adding a default implementation was not sufficient to make this a non-breaking change. While we could fix the classes internal to Angular, this would still have been a breaking change for any external developers who may have followed our implementations as an example.
9100b03 to
dae6f19
Compare
|
You can preview dae6f19 at https://pr38890-dae6f19.ngbuilds.io/. |
jelbourn
left a comment
There was a problem hiding this comment.
LGTM
Reviewed-for: public-api, size-tracking
petebacondarwin
left a comment
There was a problem hiding this comment.
Reviewed-for: size-tracking
I am surprised that these fairly small additions add ~700 bytes but probably there was already an increase on master.
|
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. |
Add new method
historyGo, that will letthe user navigate to a specific page from session history identified by its
relative position to the current page.
We add some tests to
location_spec.tsto validate the behavior of thehistoryGoandforwardmethods.Add more tests for
location_specto testlocation.historyGo(0),location.historyGo(),location.historyGo(100)andlocation.historyGo(-100). We also add new tests forIntegrationspec to validate the navigation when we usinglocation#historyGo.Update the
main-es2015size limits ofaio-local-viewengineinaio-payloadsfile.Update the
historyGofunction docsLink for the history API documentation for History#go
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