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 prioritizedGuardValue operator optimization and allowing UrlTree return from guard #26478
feat(router): add prioritizedGuardValue operator optimization and allowing UrlTree return from guard #26478
Conversation
…owing UrlTree return from guard * If all guards return `true`, operator returns `true` * `false` and `UrlTree` are now both valid returns from a guard * Both these values wait for higher priority guards to resolve * Highest priority `false` or `UrlTree` value will be returned
You can preview 5583eb3 at https://pr26478-5583eb3.ngbuilds.io/. |
…and allowing UrlTree return from guard
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 or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok 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 |
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) |
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.
LGTM. Just a few small nits.
OperatorFunction<Observable<boolean|UrlTree>[], boolean|UrlTree> { | ||
return switchMap(obs => { | ||
return combineLatest( | ||
...obs.map(o => o.pipe(take(1), startWith(INITIAL_VALUE as INTERIM_VALUES)))) |
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.
Nit: o => o.pipe(take(1), startWith(INITIAL_VALUE as INTERIM_VALUES)))
could be pulled out into it's own static function for better performance and lower memory pressure. (Also might help readability)
scan( | ||
(acc: INTERIM_VALUES, list: INTERIM_VALUES[]) => { | ||
let isPending = false; | ||
return list.reduce((innerAcc, val, i: number) => { |
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.
Nit: The reducer function inside of here could be pulled out into it's own static function (like above)
}, acc); | ||
}, | ||
INITIAL_VALUE), | ||
filter(item => item !== INITIAL_VALUE), take(1)) as Observable<boolean|UrlTree>; |
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.
Nit: Adding a trailing comma will make clang format this cleaner.
…owing UrlTree return from guard (#26478) * If all guards return `true`, operator returns `true` * `false` and `UrlTree` are now both valid returns from a guard * Both these values wait for higher priority guards to resolve * Highest priority `false` or `UrlTree` value will be returned PR Close #26478
… and allowing UrlTree return from guard (angular#26478)" This was incorrectly merged to the 7.0.x patch version branch. This reverts commit d5fa4dc.
…owing UrlTree return from guard (angular#26478) * If all guards return `true`, operator returns `true` * `false` and `UrlTree` are now both valid returns from a guard * Both these values wait for higher priority guards to resolve * Highest priority `false` or `UrlTree` value will be returned PR Close angular#26478
…owing UrlTree return from guard (angular#26478) * If all guards return `true`, operator returns `true` * `false` and `UrlTree` are now both valid returns from a guard * Both these values wait for higher priority guards to resolve * Highest priority `false` or `UrlTree` value will be returned PR Close angular#26478
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. |
true
, operator returnstrue
false
andUrlTree
are now both valid returns from a guardfalse
orUrlTree
value will be returned