@@ -40,31 +40,9 @@ interface BarStackProps {
40
40
hierarchy : any ;
41
41
}
42
42
43
- // function getComponentsArr(componentName, snapshots, node) {
44
- // //Input: Name of component and all snapshots
45
- // //Output: One array of each individual snapshot
46
-
47
- // //NOTE:
48
- // //Every snapshot is an object with a children array with a snapshot that also has a children array etc
49
- // //Children arrays more than one signify siblings
50
-
51
- // }
52
- // // snapshots.map(rootNode => {
53
- // // // rootNode.name
54
- // // let currNode = rootNode
55
- // // while (currNode) {
56
- // // if (currNode.name === componentName) {
57
- // // return currNode.componentData.props
58
- // // } else {
59
- // // currNode = currNode.children[0]
60
- // // currNode = currNode.children[1]
61
- // // }
62
- // // }
63
- // // })
64
43
const makePropsPretty = data => {
65
44
const propsFormat = [ ] ;
66
45
const nestedObj = [ ] ;
67
- // console.log('show me the data we are getting', data);
68
46
if ( typeof data !== 'object' ) {
69
47
return < p > { data } </ p > ;
70
48
}
@@ -81,7 +59,6 @@ const makePropsPretty = data => {
81
59
if ( nestedObj ) {
82
60
propsFormat . push ( nestedObj ) ;
83
61
}
84
- // console.log('this is propsformat', propsFormat);
85
62
return propsFormat ;
86
63
} ;
87
64
@@ -104,15 +81,13 @@ const collectNodes = (snaps, componentName) => {
104
81
} else {
105
82
renderResult . push ( renderTime ) ;
106
83
}
107
- console . log ( 'show me the render time' , renderTime ) ;
108
84
// compare the last pushed component Data from the array to the current one to see if there are differences
109
85
if ( x !== 0 && componentsResult . length !== 0 ) {
110
86
// needs to be stringified because values are hard to determine if true or false if in they're seen as objects
111
87
if ( JSON . stringify ( Object . values ( componentsResult [ newChange ? componentsResult . length - 1 : trackChanges ] ) [ 0 ] ) !== JSON . stringify ( cur . componentData . props ) ) {
112
88
newChange = true ;
113
89
// const props = { [`snapshot${x}`]: { rendertime: formatRenderTime(cur.componentData.actualDuration), ...cur.componentData.props } };
114
90
const props = { [ `snapshot${ x } ` ] : { ...cur . componentData . props } } ;
115
- console . log ( 'show me props structure' , props )
116
91
componentsResult . push ( props ) ;
117
92
} else {
118
93
newChange = false ;
@@ -135,23 +110,18 @@ const collectNodes = (snaps, componentName) => {
135
110
}
136
111
}
137
112
}
138
- // console.log('componentsResult looks like: ', componentsResult);
139
113
140
- // console.log('we should be seeing react components with information', componentsResult);
141
- // componentsResult.push(renderResult);
142
114
const finalResults = componentsResult . map ( ( e , index ) => {
143
115
const name = Object . keys ( e ) [ 0 ] ;
144
- console . log ( 'this is name' , name , 'show me e' , e ) ;
145
116
e [ name ] . rendertime = renderResult [ index ] ;
146
- console . log ( 'this is e' , e ) ;
147
117
return e ;
148
118
} ) ;
149
119
for ( let i = 0 ; i < finalResults . length ; i ++ ) {
150
120
for ( const componentSnapshot in finalResults [ i ] ) {
151
- finalResults [ i ] [ componentSnapshot ] = makePropsPretty ( finalResults [ i ] [ componentSnapshot ] ) ;
121
+ finalResults [ i ] [ componentSnapshot ] = makePropsPretty ( finalResults [ i ] [ componentSnapshot ] ) . reverse ( ) ;
152
122
}
153
123
}
154
- console . log ( 'finalresults ' , finalResults ) ;
124
+ console . log ( 'is this going to reverse ' , finalResults ) ;
155
125
return finalResults ;
156
126
} ;
157
127
@@ -185,13 +155,11 @@ const traverse = (snapshot, data, snapshots, currTotalRender = 0) => {
185
155
}
186
156
// increment render frequencies
187
157
if ( renderTime > 0 ) {
188
- // console.log('what is the child', child);
189
- // console.log('por que?', data.componentData[componentName]);
190
158
data . componentData [ componentName ] . renderFrequency ++ ;
191
- } else {
192
- // console.log('what is the child', child);
193
- // console.log('we dont increment here', data.componentData[componentName], 'and the child', child);
194
159
}
160
+ // else {
161
+
162
+ // }
195
163
196
164
// add to total render time
197
165
data . componentData [ componentName ] . totalRenderTime += renderTime ;
@@ -258,7 +226,6 @@ const PerformanceVisx = (props: BarStackProps) => {
258
226
const [ comparisonData , setComparisonData ] = useState ( ) ;
259
227
const NO_STATE_MSG = 'No state change detected. Trigger an event to change state' ;
260
228
const data = getPerfMetrics ( snapshots , getSnapshotIds ( hierarchy ) ) ;
261
- // console.log('this is line 220', data);
262
229
263
230
const renderComparisonBargraph = ( ) => {
264
231
if ( hierarchy ) {
0 commit comments