mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(devtools): make sure we dont fail on null elements
This commit is contained in:
@@ -63,7 +63,8 @@ const insertElementProfile = (frames: ElementProfile[], position: ElementPositio
|
||||
for (let i = 0; i < position.length - 1; i++) {
|
||||
const pos = position[i];
|
||||
if (!frames[pos]) {
|
||||
debugger;
|
||||
// console.warn('Unable to find parent node for', frames);
|
||||
return;
|
||||
}
|
||||
frames = frames[pos].children;
|
||||
}
|
||||
|
||||
+5
@@ -28,6 +28,11 @@ const getLabel = (element: ElementProfile) => {
|
||||
const addFrame = (nodes: FlamegraphNode[], elements: ElementProfile[]): number => {
|
||||
let timeSpent = 0;
|
||||
elements.forEach(element => {
|
||||
// Possibly undefined because of the insertion
|
||||
// on the backend.
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
const node: FlamegraphNode = {
|
||||
value: element.directives.reduce((a, c) => a + c.lifecycle + c.changeDetection, 0),
|
||||
label: getLabel(element),
|
||||
|
||||
Reference in New Issue
Block a user