-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
feat(router): add UrlSegment[] to CanLoad interface #13127
feat(router): add UrlSegment[] to CanLoad interface #13127
Conversation
@vicb any chance of getting this one merged soon ? It solves a valid use-case (capturing the url without having to load a lazy module), and it appears to be a non breaking change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Please make a couple minor updates, rebase, and let's get this merged. Sorry it's been sitting for a while.
@@ -273,11 +273,12 @@ class ApplyRedirects { | |||
} | |||
} | |||
|
|||
private getChildConfig(injector: Injector, route: Route): Observable<LoadedRouterConfig> { | |||
private getChildConfig(injector: Injector, route: Route, urlSegments: UrlSegment[]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with other methods receiving UrlSegment[]
, please name the param segments
.
@@ -383,15 +384,16 @@ class ApplyRedirects { | |||
} | |||
} | |||
|
|||
function runGuards(injector: Injector, route: Route): Observable<boolean> { | |||
function runGuards( | |||
injector: Injector, route: Route, urlSegments: UrlSegment[]): Observable<boolean> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name it segments
.
* route: Route | ||
* ): Observable<boolean>|Promise<boolean>|boolean { | ||
* return this.permissions.canLoadChildren(this.currentUser, route); | ||
* canLoad(route: Route, urlSegments: UrlSegment[]): Observable<boolean>|Promise<boolean>|boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This formatting looks bad. Can you reformat more similarly to how it was before?
@marcuskrahl I went ahead and tried to get this rebased for you. But it's not working after the changes I made. Basically, when you submitted this PR all the files were under |
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
62afa5e
to
312f397
Compare
CLAs look good, thanks! |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
84292f3
to
92e4eeb
Compare
CLAs look good, thanks! |
0dd38d2
to
cf31338
Compare
@jasonaden I made the necessary changes and everything should work as expected again. The unit tests run successfully. However the travis e2e test seems to be broken for everyone for now so I am waiting for this to be fixed. |
@marcuskrahl Okay, thanks. Please rebase again. We had an issue that messed up the commit histories on many PRs. So this one needs a new rebase as it's showing hundreds of commits. |
cf31338
to
22faaf3
Compare
What's the status of this? |
Please merge |
Any idea about when this should be merged? |
22faaf3
to
9141447
Compare
I rebased again. Giving this another try to get merged |
When will it be merged? |
Hi @marcuskrahl! This PR has merge conflicts due to recent upstream merges. |
1 similar comment
Hi @marcuskrahl! This PR has merge conflicts due to recent upstream merges. |
9141447
to
fc68e9a
Compare
CanLoad now defines UrlSegment[] as a second parameter of the function. Users can store the initial url segments and refer to them later, e.g. to go back to the original url after authentication via router.navigate(urlSegments). Existing code still works as before because the second function parameter does not have to be defined. Closes angular#12411
fc68e9a
to
68ba3d7
Compare
I fixed the conflicts so this PR should be good to merge again |
Any news? I'm hoping that this can be merged and included in the v6. |
Any update on this? we also need this fix to be available. |
CanLoad now defines UrlSegment[] as a second parameter of the function. Users can store the initial url segments and refer to them later, e.g. to go back to the original url after authentication via router.navigate(urlSegments). Existing code still works as before because the second function parameter does not have to be defined. Closes angular#12411 PR Close angular#13127
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. |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x")
What is the current behavior? (You can also link to an open issue here)
The
Route
object as passed to implementations ofCanLoad
which only provides minimal information on the page which should be navigated to. (see #12411)What is the new behavior?
Additionally to
Route
anUrlSegment[]
is passed to implementations ofCanLoad
as a second parameter. It contains the array of path elements the user tried to navigate to beforecanLoad
is evaluated.Does this PR introduce a breaking change? (check one with "x")
Other information:
CanLoad now defines UrlSegment[] as a second parameter of the function.
Users can store the initial url segments and refer to them later, e.g. to go
back to the original url after authentication via router.navigate(urlSegments).
Existing code still works as before because the second function parameter
does not have to be defined.
Closes #12411