Skip to content
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

refactor(core): remove prolyfill from error message #20121

Closed
wants to merge 1 commit into from

Conversation

Toxicable
Copy link

@Toxicable Toxicable commented Nov 2, 2017

Remove prolyfill from error msg to avoid future issues such as
#20120 #12119 #19677 #18581 #11839 #20182

@Toxicable Toxicable force-pushed the prolyfill branch 7 times, most recently from dba4ba8 to 0029de6 Compare November 3, 2017 02:54
@gkalpak gkalpak added area: core Issues related to the framework runtime action: review The PR is still awaiting reviews from at least one requested reviewer type: docs target: patch This PR is targeted for the next patch release labels Nov 3, 2017
@@ -118,6 +118,8 @@ export class NgZone {

constructor({enableLongStackTrace = false}) {
if (typeof Zone == 'undefined') {
// prolyfill = probably a polyfill ie you can not polyfill something that is not a standard
// yet
throw new Error('Angular requires Zone.js prolyfill.');
Copy link
Contributor

Choose a reason for hiding this comment

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

I have just discussed with @mhevery, the best would be to remove "prolyfill" entirely here

Copy link
Author

Choose a reason for hiding this comment

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

Done

@Toxicable Toxicable changed the title refactor(core): explain what a prolyfill is refactor(core): remove prolyfill from error message Nov 3, 2017
@@ -118,7 +118,7 @@ export class NgZone {

constructor({enableLongStackTrace = false}) {
if (typeof Zone == 'undefined') {
throw new Error('Angular requires Zone.js prolyfill.');
throw new Error('Angular requires Zone.js');
Copy link
Contributor

Choose a reason for hiding this comment

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

Now it's missing the period at the end ;P

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it is worth updating the message to mention the noop option.
I.e. Angular does not require Zone.js any more so this error might be a result of someone (incorrectly) trying to use the ngZone: noop option.

Copy link
Author

Choose a reason for hiding this comment

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

I thought of this. However, the only situation this error can happen is when we aren't in the nooped zone right?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we will be in non-nooped zone without the Zone.js polyfill. The question is why did we end up in this situation? 😃

It could be either because we want to use Zone.js, but forgot to load the polyfill.
Or it could be that we want to not use Zone.js, but didn't know how (or forgot) to properly configure ngZone: 'noop'.

Copy link
Author

@Toxicable Toxicable Nov 6, 2017

Choose a reason for hiding this comment

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

Ahhh right I see you point about the second part.
maybe something like

Angular requires Zone.js, unless you are using ngZone: 'noop'

I think that should be a reasonable prompt on what to google to find out more.
Would be nice to include things like links to docs but I don't think we have docs on this just yet and it would bloat bundle size more than we have to

Copy link
Member

Choose a reason for hiding this comment

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

SGTM (fwiw 😃)

Copy link
Author

Choose a reason for hiding this comment

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

done

@Toxicable Toxicable force-pushed the prolyfill branch 2 times, most recently from 5dc5937 to 98fd88b Compare November 6, 2017 10:06
@@ -118,7 +118,7 @@ export class NgZone {

constructor({enableLongStackTrace = false}) {
if (typeof Zone == 'undefined') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I had to reads "unless you are using ngZone: 'noop'" to figure out what you mean...
I think I got it now but does "unless you are using ngZone: 'noop'" make any sense ?

  • it is not explicit enough IMO,
  • we would not throw in this case anyway.

So what about throw new Error('In this configuration Angular requires Zone.js'); or something along the line ? If you feel like we need more details then we should add something to angular.io and a short link here.

Copy link
Author

Choose a reason for hiding this comment

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

The reason why I chose "unless" was becasue of the situation @gkalpak mentioned above

  • You want to not use zones so you removed zone.js but you forgot to configure { ngZone: 'noop'}

My idea with being slightly vague here "unless you are using ngZone: 'noop'" is that devs who don't know what this means would be more likely to disregard it, since this will not apply to the vast majority of situations.

In saying that I do think we need some docs around this area.

Copy link
Author

Choose a reason for hiding this comment

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

After discussing it a little more I now think that @vicb 's solution is preferable. Since it is very unlikely for the top situation to occur.

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

see inline comments

@vicb vicb added action: merge The PR is ready for merge by the caretaker state: blocked and removed action: review The PR is still awaiting reviews from at least one requested reviewer action: merge The PR is ready for merge by the caretaker labels Nov 10, 2017
@vicb
Copy link
Contributor

vicb commented Nov 10, 2017

Please make sure Travis gets green (can not restart the job right through the UI but I guess it's a flake)

@vicb vicb added action: merge The PR is ready for merge by the caretaker and removed state: blocked labels Nov 10, 2017
@Toxicable
Copy link
Author

Toxicable commented Nov 10, 2017

@vicb good to go now, looks like it was a flake due to timeouts, not sure of the cause

@angular-automatic-lock-bot
Copy link

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 12, 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: core Issues related to the framework runtime cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants