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

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@jasonaden
Contributor

jasonaden commented Oct 16, 2018

  • 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
feat(router): add prioritizedGuardValue operator optimization and all…
…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
@mary-poppins

This comment has been minimized.

mary-poppins commented Oct 16, 2018

fixup! feat(router): add prioritizedGuardValue operator optimization …
…and allowing UrlTree return from guard
@googlebot

This comment has been minimized.

googlebot commented Oct 16, 2018

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 cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@googlebot googlebot added cla: no and removed cla: yes labels Oct 16, 2018

@mhevery mhevery added cla: yes and removed cla: no labels Oct 16, 2018

@googlebot

This comment has been minimized.

googlebot commented Oct 16, 2018

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.)

@mhevery

This comment has been minimized.

@benlesh

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))))

This comment has been minimized.

@benlesh

benlesh Oct 17, 2018

Contributor

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) => {

This comment has been minimized.

@benlesh

benlesh Oct 17, 2018

Contributor

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>;

This comment has been minimized.

@benlesh

benlesh Oct 17, 2018

Contributor

Nit: Adding a trailing comma will make clang format this cleaner.

mhevery added a commit that referenced this pull request Oct 18, 2018

feat(router): add prioritizedGuardValue operator optimization and all…
…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

alxhub added a commit to alxhub/angular that referenced this pull request Oct 23, 2018

Revert "feat(router): add prioritizedGuardValue operator optimization…
… and allowing UrlTree return from guard (angular#26478)"

This was incorrectly merged to the 7.0.x patch version branch.

This reverts commit d5fa4dc.

alxhub added a commit that referenced this pull request Oct 23, 2018

Revert "feat(router): add prioritizedGuardValue operator optimization…
… and allowing UrlTree return from guard (#26478)" (#26700)

This was incorrectly merged to the 7.0.x patch version branch.

This reverts commit d5fa4dc.

PR Close #26700

sculove added a commit to sculove/angular that referenced this pull request Nov 2, 2018

feat(router): add prioritizedGuardValue operator optimization and all…
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment