Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

Fix "application error" communication, introduce new class of error for AoT applications, introduce performance optimization for applications that are not being debugged #741

Merged
merged 3 commits into from
Oct 18, 2016

Conversation

clbond
Copy link
Contributor

@clbond clbond commented Oct 18, 2016

  • Resolve problem with ApplicationError communication between backend and frontend
  • Add new class of error for applications built with AoT enabled and cannot be debugged
  • Introduce new performance optimization where we do not subscribe to Angular changes unless we know the developer has actually opened the wAugury tab

@mention-bot
Copy link

@clbond, thanks for your PR! By analyzing the history of the files in this pull request, we identified @xorgy, @sumitarora and @stevenkampen to be potential reviewers.

@igor-ka
Copy link

igor-ka commented Oct 18, 2016

everything looks good @clbond, just a couple of questions in my comments. Other than that I think the best would be to describe the story for this under a separate issue so as to know what to expect this code to do. What do you think?

const bind = (root: DebugElement) => {
if (root.injector == null) {
// In AoT-enabled debug builds, the data we get back from {@link ng.probe}
Copy link

Choose a reason for hiding this comment

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

This is not completely true. A user has to do both:

  1. use AOT in debug mode and
  2. NOT call enableProdMode()

Then this data is filled, even with AOT.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not my experience. I created a new app with "ng new" and then ran with "ng serve --aot=true --debug=true".

In my Console it says: lang.js:255 Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.

Then if I try to get the DebugElement for the root component using ng.probe($('app-root')), I get this object back:

DebugElement {_debugInfo: null, nativeNode: app-root, parent: null, listeners: Array[0], properties: Object…}
_debugInfo: null
attributes: Object
childNodes: Array[2]
children: (...)
classes: Object
componentInstance: null
context: null
injector: null
listeners: Array[0]
nativeElement: app-root
nativeNode: app-root
parent: null
properties: Object
providerTokens: (...)
references: (...)
source: (...)
styles: Object
__proto__: DebugNode

On this object, both injector and componentInstance are null

@clbond
Copy link
Contributor Author

clbond commented Oct 18, 2016

This resolves #742

@clbond
Copy link
Contributor Author

clbond commented Oct 18, 2016

I removed the comment and made the error messages more generic.

… and frontend

* Add new class of error for applications built with AoT enabled and cannot be debugged
* Introduce new performance optimization where we do not subscribe to Angular changes unless we know the developer has actually opened the Augury tab
…es for missing debug info or missing "window.ng" property
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants