@@ -40,31 +40,9 @@ interface BarStackProps {
4040 hierarchy : any ;
4141}
4242
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- // // })
6443const makePropsPretty = data => {
6544 const propsFormat = [ ] ;
6645 const nestedObj = [ ] ;
67- // console.log('show me the data we are getting', data);
6846 if ( typeof data !== 'object' ) {
6947 return < p > { data } </ p > ;
7048 }
@@ -81,7 +59,6 @@ const makePropsPretty = data => {
8159 if ( nestedObj ) {
8260 propsFormat . push ( nestedObj ) ;
8361 }
84- // console.log('this is propsformat', propsFormat);
8562 return propsFormat ;
8663} ;
8764
@@ -104,15 +81,13 @@ const collectNodes = (snaps, componentName) => {
10481 } else {
10582 renderResult . push ( renderTime ) ;
10683 }
107- console . log ( 'show me the render time' , renderTime ) ;
10884 // compare the last pushed component Data from the array to the current one to see if there are differences
10985 if ( x !== 0 && componentsResult . length !== 0 ) {
11086 // needs to be stringified because values are hard to determine if true or false if in they're seen as objects
11187 if ( JSON . stringify ( Object . values ( componentsResult [ newChange ? componentsResult . length - 1 : trackChanges ] ) [ 0 ] ) !== JSON . stringify ( cur . componentData . props ) ) {
11288 newChange = true ;
11389 // const props = { [`snapshot${x}`]: { rendertime: formatRenderTime(cur.componentData.actualDuration), ...cur.componentData.props } };
11490 const props = { [ `snapshot${ x } ` ] : { ...cur . componentData . props } } ;
115- console . log ( 'show me props structure' , props )
11691 componentsResult . push ( props ) ;
11792 } else {
11893 newChange = false ;
@@ -135,23 +110,18 @@ const collectNodes = (snaps, componentName) => {
135110 }
136111 }
137112 }
138- // console.log('componentsResult looks like: ', componentsResult);
139113
140- // console.log('we should be seeing react components with information', componentsResult);
141- // componentsResult.push(renderResult);
142114 const finalResults = componentsResult . map ( ( e , index ) => {
143115 const name = Object . keys ( e ) [ 0 ] ;
144- console . log ( 'this is name' , name , 'show me e' , e ) ;
145116 e [ name ] . rendertime = renderResult [ index ] ;
146- console . log ( 'this is e' , e ) ;
147117 return e ;
148118 } ) ;
149119 for ( let i = 0 ; i < finalResults . length ; i ++ ) {
150120 for ( const componentSnapshot in finalResults [ i ] ) {
151- finalResults [ i ] [ componentSnapshot ] = makePropsPretty ( finalResults [ i ] [ componentSnapshot ] ) ;
121+ finalResults [ i ] [ componentSnapshot ] = makePropsPretty ( finalResults [ i ] [ componentSnapshot ] ) . reverse ( ) ;
152122 }
153123 }
154- console . log ( 'finalresults ' , finalResults ) ;
124+ console . log ( 'is this going to reverse ' , finalResults ) ;
155125 return finalResults ;
156126} ;
157127
@@ -185,13 +155,11 @@ const traverse = (snapshot, data, snapshots, currTotalRender = 0) => {
185155 }
186156 // increment render frequencies
187157 if ( renderTime > 0 ) {
188- // console.log('what is the child', child);
189- // console.log('por que?', data.componentData[componentName]);
190158 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);
194159 }
160+ // else {
161+
162+ // }
195163
196164 // add to total render time
197165 data . componentData [ componentName ] . totalRenderTime += renderTime ;
@@ -258,7 +226,6 @@ const PerformanceVisx = (props: BarStackProps) => {
258226 const [ comparisonData , setComparisonData ] = useState ( ) ;
259227 const NO_STATE_MSG = 'No state change detected. Trigger an event to change state' ;
260228 const data = getPerfMetrics ( snapshots , getSnapshotIds ( hierarchy ) ) ;
261- // console.log('this is line 220', data);
262229
263230 const renderComparisonBargraph = ( ) => {
264231 if ( hierarchy ) {
0 commit comments