Skip to content

Commit 08fa251

Browse files
andytsou19vnguyen95
andcommitted
performance tab fixed render place
Co-authored-by: Viet Nguyen <[email protected]>
1 parent 2855d77 commit 08fa251

File tree

4 files changed

+27
-58
lines changed

4 files changed

+27
-58
lines changed

src/app/components/ComponentMap.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export default function ComponentMap({
229229
if (nestedObj) {
230230
propsFormat.push(nestedObj);
231231
}
232-
// console.log('this is propsformat', propsFormat);
232+
233233
return propsFormat;
234234
};
235235

@@ -261,7 +261,7 @@ export default function ComponentMap({
261261
};
262262
findSelectedNode();
263263

264-
// controls for the map
264+
// controls for the map
265265
const LinkComponent = getLinkComponent({ layout, linkType, orientation });
266266
return totalWidth < 10 ? null : (
267267
<div>
@@ -400,25 +400,25 @@ export default function ComponentMap({
400400
// setTooltip(true);
401401
// }
402402
}}
403-
onMouseEnter={() => dispatch(onHover(node.data.rtid))} // fix this not working
403+
onMouseEnter={() => dispatch(onHover(node.data.rtid))}
404404
onMouseLeave={() => dispatch(onHoverExit(node.data.rtid))}
405405
/>
406-
)}
406+
)}
407407
{/* Display text inside of each component node */}
408408
<text
409-
dy=".33em"
410-
fontSize={10}
411-
fontFamily="Roboto"
412-
textAnchor="middle"
413-
style={{ pointerEvents: 'none' }}
414-
fill={
415-
node.depth === 0
416-
? '#161521'
417-
: node.children
418-
? 'white'
419-
: '#161521'
420-
}
421-
z
409+
dy=".33em"
410+
fontSize={10}
411+
fontFamily="Roboto"
412+
textAnchor="middle"
413+
style={{ pointerEvents: 'none' }}
414+
fill={
415+
node.depth === 0
416+
? '#161521'
417+
: node.children
418+
? 'white'
419+
: '#161521'
420+
}
421+
z
422422
>
423423
{node.data.name}
424424
</text>

src/app/components/History.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ function History(props: Record<string, unknown>) {
3131
const svgRef = React.useRef(null);
3232
const root = JSON.parse(JSON.stringify(hierarchy));
3333

34-
console.log('DEBUG >>> HISTORY currLocation: ', currLocation);
35-
3634
// setting the margins for the Map to render in the tab window.
3735
const innerWidth = totalWidth - margin.left - margin.right;
3836
const innerHeight = totalHeight - margin.top - margin.bottom - 60;

src/app/components/PerformanceVisx.tsx

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
// // })
6443
const 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,7 +81,6 @@ 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
@@ -134,23 +110,18 @@ const collectNodes = (snaps, componentName) => {
134110
}
135111
}
136112
}
137-
// console.log('componentsResult looks like: ', componentsResult);
138113

139-
// console.log('we should be seeing react components with information', componentsResult);
140-
// componentsResult.push(renderResult);
141114
const finalResults = componentsResult.map((e, index) => {
142115
const name = Object.keys(e)[0];
143-
console.log('this is name', name, 'show me e', e);
144116
e[name].rendertime = renderResult[index];
145-
console.log('this is e', e);
146117
return e;
147118
});
148119
for (let i = 0; i < finalResults.length; i++) {
149120
for (const componentSnapshot in finalResults[i]) {
150-
finalResults[i][componentSnapshot] = makePropsPretty(finalResults[i][componentSnapshot]);
121+
finalResults[i][componentSnapshot] = makePropsPretty(finalResults[i][componentSnapshot]).reverse();
151122
}
152123
}
153-
console.log('finalresults', finalResults);
124+
console.log('is this going to reverse', finalResults);
154125
return finalResults;
155126
};
156127

@@ -184,13 +155,11 @@ const traverse = (snapshot, data, snapshots, currTotalRender = 0) => {
184155
}
185156
// increment render frequencies
186157
if (renderTime > 0) {
187-
// console.log('what is the child', child);
188-
// console.log('por que?', data.componentData[componentName]);
189158
data.componentData[componentName].renderFrequency++;
190-
} else {
191-
// console.log('what is the child', child);
192-
// console.log('we dont increment here', data.componentData[componentName], 'and the child', child);
193159
}
160+
// else {
161+
162+
// }
194163

195164
// add to total render time
196165
data.componentData[componentName].totalRenderTime += renderTime;
@@ -257,7 +226,6 @@ const PerformanceVisx = (props: BarStackProps) => {
257226
const [comparisonData, setComparisonData] = useState();
258227
const NO_STATE_MSG = 'No state change detected. Trigger an event to change state';
259228
const data = getPerfMetrics(snapshots, getSnapshotIds(hierarchy));
260-
// console.log('this is line 220', data);
261229

262230
const renderComparisonBargraph = () => {
263231
if (hierarchy) {

src/app/components/RenderingFrequency.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ const ComponentCard = props => {
5454
// render time for each component from each snapshot
5555
// differences in state change that happened prior;
5656

57-
5857
const dataComponentArray = [];
5958
for (let i = 0; i < information.length; i++) {
6059
dataComponentArray.push(<DataComponent header={Object.keys(information[i])} paragraphs={Object.values(information[i])} />);
@@ -106,6 +105,10 @@ const DataComponent = props => {
106105
paragraphs,
107106
} = props;
108107

108+
// current bug
109+
// we want render time to display first but it gets push to the end of the array
110+
// first pop is because the last item of array is always empty for some reason
111+
109112
// const [{ tabs, currentTab }, dispatch] = useStoreContext();
110113
return (
111114
<div>
@@ -114,7 +117,7 @@ const DataComponent = props => {
114117
{header}
115118
</h4>
116119
<p>
117-
{' '}
120+
118121
{paragraphs}
119122
</p>
120123
</div>

0 commit comments

Comments
 (0)