Skip to content

Commit

Permalink
fix(devtools): don't access service prop unnecessarily
Browse files Browse the repository at this point in the history
The code was requesting index 0 of each item in the LView before checking
if it is an array. This causes issues with services that only allow calls to
properties that are defined on the service (backed by a strict ES6 proxy).
A check if the type is Array first corrects this issue.

fixes issue rangle/angular-devtools#802
  • Loading branch information
markwhitfeld authored and mgechev committed May 23, 2021
1 parent ded6796 commit d60bdfc
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -108,13 +108,14 @@ export class LTreeStrategy {
const lView = lViewOrLContainer;
const tView = lView[LVIEW_TVIEW];
for (let i = HEADER_OFFSET; i < lView.length; i++) {
if (lView[i] && tView.data && lView[i][ELEMENT] instanceof Node) {
const lViewItem = lView[i];
if (tView.data && Array.isArray(lViewItem) && lViewItem[ELEMENT] instanceof Node) {
const node = this._getNode(lView, tView.data, i);

// TODO(mgechev): verify if this won't make us skip projected content.
if (node.component || node.directives.length) {
nodes.push(node);
this._extract(lView[i], node.children);
this._extract(lViewItem, node.children);
}
}
}
Expand Down

0 comments on commit d60bdfc

Please sign in to comment.