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
Conversation
dba4ba8
to
0029de6
Compare
packages/core/src/zone/ng_zone.ts
Outdated
@@ -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.'); |
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.
I have just discussed with @mhevery, the best would be to remove "prolyfill" entirely here
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.
Done
packages/core/src/zone/ng_zone.ts
Outdated
@@ -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'); |
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.
Now it's missing the period at the end ;P
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.
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.
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.
I thought of this. However, the only situation this error can happen is when we aren't in the nooped zone right?
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.
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'
.
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.
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
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.
SGTM (fwiw 😃)
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.
done
5dc5937
to
98fd88b
Compare
@@ -118,7 +118,7 @@ export class NgZone { | |||
|
|||
constructor({enableLongStackTrace = false}) { | |||
if (typeof Zone == 'undefined') { |
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.
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.
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.
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.
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.
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.
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.
see inline comments
Please make sure Travis gets green (can not restart the job right through the UI but I guess it's a flake) |
@vicb good to go now, looks like it was a flake due to timeouts, not sure of the cause |
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. |
Remove prolyfill from error msg to avoid future issues such as
#20120 #12119 #19677 #18581 #11839 #20182