Skip to content

Commit c0a2029

Browse files
committed
perf view bold font; lighten colors for deep hierarchies; remove reactWorkTags
1 parent 6a362c0 commit c0a2029

File tree

5 files changed

+24
-30
lines changed

5 files changed

+24
-30
lines changed

src/app/components/PerfView.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface PerfViewProps {
3131

3232
const PerfView = (props:PerfViewProps) => {
3333
const { snapshots, viewIndex, width, height } = props
34+
let adjustedSize = Math.min(width, height);
3435
const svgRef = useRef(null);
3536

3637
// Figure out which snapshot index to use
@@ -41,19 +42,18 @@ const PerfView = (props:PerfViewProps) => {
4142
// Set up color scaling function
4243
const colorScale = d3.scaleLinear()
4344
.domain([0, 7])
44-
.range(['hsl(200,60%,60%)', 'hsl(255,30%,30%)'])
45-
// .range(['hsl(152,30%,80%)', 'hsl(228,30%,40%)'])
45+
.range(['hsl(200,60%,60%)', 'hsl(255,30%,60%)'])
4646
.interpolate(d3.interpolateHcl);
4747

4848
// Set up circle-packing layout function
4949
const packFunc = useCallback((data:object) => {
5050
return d3.pack()
51-
.size([width, height])
51+
.size([adjustedSize, adjustedSize])
5252
// .radius(d => { return d.r; })
5353
.padding(3)(d3.hierarchy(data)
5454
.sum((d:{componentData?:{actualDuration?:number}}) => { return d.componentData.actualDuration || 0; })
5555
.sort((a:{value:number}, b:{value:number}) => { return b.value - a.value; }));
56-
}, [width, height]);
56+
}, [adjustedSize]);
5757

5858
// If indexToDisplay changes, clear old tree nodes
5959
useEffect(() => {
@@ -79,8 +79,12 @@ const PerfView = (props:PerfViewProps) => {
7979
let view;
8080

8181
// Set up viewBox dimensions and onClick for parent svg
82+
83+
// console.log("PerfView -> height", height)
84+
// console.log("PerfView -> width", width)
85+
// console.log("PerfView -> adjustedSize", adjustedSize)
8286
const svg = d3.select(svgRef.current)
83-
.attr('viewBox', `-${width / 2} -${height / 2} ${width} ${height}`)
87+
.attr('viewBox', `-${adjustedSize / 2} -${adjustedSize / 2} ${width} ${height}`)
8488
.on('click', () => zoomToNode(packedRoot));
8589

8690
// Connect circles below root to data

src/app/styles/components/d3graph.css

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ div.tooltip {
5454
max-width: 250px;
5555
overflow-wrap: break-word;
5656
padding: 6px;
57-
color: #1a2229;
57+
color: #320a5c;
5858
font-size: 12px;
5959
font-family: "Overpass Mono", monospace;
60-
background: #6699C4;
60+
background: #9cf4df;
6161
border-radius: 8px;
6262
pointer-events: none;
6363
}
6464

6565
.d3-tip {
6666
line-height: 1;
6767
padding: 6px;
68-
background: #6699C4;
69-
color: #1a2229;
68+
background: #9cf4df;
69+
color: #320a5c;
7070
border-radius: 4px;
7171
font-size: 13px;
7272
max-width: 400px;
@@ -80,7 +80,7 @@ div.tooltip {
8080
display: inline;
8181
font-size: 15px;
8282
line-height: 1;
83-
color: #6699C4;
83+
color: #9cf4df;
8484
content: "\25BC";
8585
position: absolute;
8686
text-align: center;
@@ -102,9 +102,9 @@ div.tooltip {
102102
}
103103

104104
.perf-d3-container {
105-
display: flex;
106-
flex-direction: column;
107-
justify-content: space-between;
105+
/* display: flex; */
106+
/* flex-direction: column; */
107+
/* justify-content: space-between; */
108108
height: calc(100% - 70px);
109109
/* border: 2px solid red; */
110110
}
@@ -115,6 +115,7 @@ div.tooltip {
115115

116116
.perf-chart-labels {
117117
font: 1.3em sans-serif;
118+
font-weight: bold;
118119
/* font-size: calc(12px + .8vw); */
119120
/* color: white; */
120121
/* fill: rgb(231, 231, 231); */

src/backend/linkFiber.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
109109
} = currentFiber;
110110

111111
let newState: any;
112-
let componentData: ComponentData;
112+
let componentData: ComponentData = {};
113113
let componentFound = false;
114114

115115
// Check if node is a stateful setState component

src/backend/reactWorkTags.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/backend/types/backendTypes.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ export interface MsgData {
2727
}
2828

2929
export interface ComponentData {
30-
index: number;
31-
actualDuration: number;
32-
actualStartTime: number;
33-
selfBaseDuration: number;
34-
treeBaseDuration: number;
30+
index?: number;
31+
actualDuration?: number;
32+
actualStartTime?: number;
33+
selfBaseDuration?: number;
34+
treeBaseDuration?: number;
3535
}
3636

3737
interface HookStateItem {

0 commit comments

Comments
 (0)