Skip to content

[4.x only] fix(router): do not finish bootstrap until all the routes are resolved#14155

Closed
vsavkin wants to merge 1 commit into
angular:masterfrom
vsavkin:router_boostrap_fix
Closed

[4.x only] fix(router): do not finish bootstrap until all the routes are resolved#14155
vsavkin wants to merge 1 commit into
angular:masterfrom
vsavkin:router_boostrap_fix

Conversation

@vsavkin
Copy link
Copy Markdown
Contributor

@vsavkin vsavkin commented Jan 27, 2017

Updated 2.x branch #14327

@vsavkin vsavkin force-pushed the router_boostrap_fix branch 8 times, most recently from 85329f7 to d7b75da Compare January 28, 2017 22:49
@vicb vicb added area: i18n Issues related to localization and internationalization action: review The PR is still awaiting reviews from at least one requested reviewer labels Feb 3, 2017
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should it be exported ?

Copy link
Copy Markdown
Contributor Author

@vsavkin vsavkin Feb 6, 2017

Choose a reason for hiding this comment

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

You are right. It should be. As far as I know webworkers do not work with AoT, so it won't make a difference. I'll export it.

Comment thread modules/@angular/router/src/router.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we remove the reference to "experimental libs" here (I doubt we will update the comment later on) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread modules/@angular/router/src/router.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

any ->type ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread modules/@angular/router/src/router.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

any ->type

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread modules/@angular/router/src/router.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

any -> type

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

?

Comment thread modules/@angular/router/src/router.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should the default be null ? (what is the benefit of having an explicit default ?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

so we don't have to check for null and use polymorphism to handle this case. We use the same approach to handle other defaults in the router (e.g., defaultErrorHandler)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

new Promise(res => res()) -> Promise.resolve(null) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Function ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread modules/@angular/router/src/router.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we have testsfor the return value ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Every integration test checks this value since it is used by the navigation pipeline. If the value were incorrect, the navigation results would have been different.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

makes sense

@vicb
Copy link
Copy Markdown
Contributor

vicb commented Feb 3, 2017

Thanks for the PR and sorry for the review delay.

Mostly nits, missing tests ?

@vsavkin vsavkin force-pushed the router_boostrap_fix branch from d7b75da to e9c420e Compare February 6, 2017 23:27
@vsavkin
Copy link
Copy Markdown
Contributor Author

vsavkin commented Feb 6, 2017

Thanks for reviewing it! I addressed the comments.

I created bootstrap.spec.ts that tests the behaviour. What do you think should be tested separately?

@vsavkin
Copy link
Copy Markdown
Contributor Author

vsavkin commented Feb 6, 2017

Btw, I also have a version of this PR for the 2.x branch #14327

@vicb vicb changed the title Router Bootstrap Fix [4.x only] fix(router): do not finish bootstrap until all the routes are resolved Feb 7, 2017
@vsavkin vsavkin force-pushed the router_boostrap_fix branch from e9c420e to d95e1ec Compare February 7, 2017 16:18
Comment thread modules/@angular/router/src/router.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

void vs null ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

void isn't an expression. I can use undefined, but I don't think we use undefined very much in the codebase, that's why I chose null.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove "experimental"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@vsavkin vsavkin force-pushed the router_boostrap_fix branch from d95e1ec to 9252c92 Compare February 7, 2017 17:21
@vicb vicb added the action: merge The PR is ready for merge by the caretaker label Feb 7, 2017
@vicb vicb added pr_state: LGTM (DEPRECATED USE GH REVIEWS) and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Feb 7, 2017
@mhevery
Copy link
Copy Markdown
Contributor

mhevery commented Feb 7, 2017

@vicb this breaks g3. Could you have a look?

@vsavkin
Copy link
Copy Markdown
Contributor Author

vsavkin commented Feb 7, 2017

Update: I cherry-picked the commit onto the 2.x branch. You can find it here: #14327

@vsavkin vsavkin force-pushed the router_boostrap_fix branch from 9252c92 to f33f7b8 Compare February 17, 2017 21:13
vicb added a commit to vicb/angular that referenced this pull request Feb 21, 2017
vicb added a commit that referenced this pull request Feb 21, 2017
vicb pushed a commit to vicb/angular that referenced this pull request Feb 21, 2017
@vicb vicb closed this in 2a191ca Feb 21, 2017
@angular-automatic-lock-bot
Copy link
Copy Markdown

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 Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: i18n Issues related to localization and internationalization cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants