Skip to content

Commit b7d03ad

Browse files
committed
Added the card visual and functionality in RenderingFrequency
> > Co-authored-by: Nkmai <[email protected]> Co-authored-by: lind-tania <[email protected]> Co-authored-by: rtviner <[email protected]> Co-authored-by: caitlinchan23 <[email protected]>  
1 parent 64fe2a9 commit b7d03ad

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

src/app/components/PerformanceVisx.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { schemeSet3 } from 'd3-scale-chromatic';
1212
import snapshots from './snapshots';
1313
import { onHover, onHoverExit } from '../actions/actions';
1414
import { useStoreContext } from '../store'
15-
15+
import RenderingFrequency from './RenderingFrequency'
1616
/* NOTES
1717
Issue - Not fully compatible with recoil apps. Reference the recoil-todo-test.
1818
Barstacks display inconsistently...however, almost always displays upon initial test app load or
@@ -179,9 +179,33 @@ const PerformanceVisx = (props: BarStackProps) => {
179179
snapshotIdScale.rangeRound([0, xMax]);
180180
renderingScale.range([yMax, 0]);
181181

182+
183+
// let cards = []
184+
// const updateData = object => {
185+
// // for (let key in data.componentData) {
186+
// for (let key in object) {
187+
// let componentKey = object[key]
188+
// // let componentKey = data.componentData[key]
189+
// let averageRendering= (componentKey['totalRenderTime']/ componentKey['renderFrequency']).toPrecision(3)
190+
// cards.push(<RenderingFrequency
191+
// key={componentKey['rtid']}
192+
// name={key}
193+
// renderTimes={componentKey['renderFrequency']}
194+
// state={componentKey['stateType']}
195+
// average={averageRendering}
196+
// />)
197+
// }
198+
// return cards
199+
// }
200+
// updateData(data.componentData)
201+
202+
203+
204+
182205
// if performance tab is too small it will not return VISX component
183206
return width < 10 ? null : (
184207
<div style={{ position: 'relative' }}>
208+
<RenderingFrequency data={data.componentData}/>
185209
<svg ref={containerRef} width={width} height={height}>
186210
<rect
187211
x={0}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from 'react'
2+
3+
4+
5+
const RenderingFrequency = (props) => {
6+
console.log(props)
7+
const perfData = props.data
8+
9+
return (
10+
<div>
11+
{
12+
Object.keys(perfData).map( componentName => {
13+
const currentComponent = perfData[componentName]
14+
return (
15+
<div>
16+
<h2>{componentName} </h2>
17+
<p>{currentComponent.stateType}</p>
18+
<div>Render Count: {currentComponent.renderFrequency} </div>
19+
<p>Average Time: {(currentComponent.totalRenderTime/currentComponent.renderFrequency).toFixed(3) } ms</p>
20+
</div>
21+
)
22+
})
23+
}
24+
</div>
25+
)
26+
}
27+
28+
export default RenderingFrequency

0 commit comments

Comments
 (0)