Skip to content

Commit f435295

Browse files
(updated) snapshot interace
1 parent 81aae05 commit f435295

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/app/components/PerformanceVisx.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ seen in recoil apps...
2020
*/
2121

2222
/* TYPESCRIPT */
23-
type snapshot = any;
24-
2523
interface margin { top: number; right: number; bottom: number; left: number };
2624

2725
interface TooltipData {
@@ -35,6 +33,10 @@ interface TooltipData {
3533
color: string;
3634
}
3735

36+
interface data {
37+
snapshotId?: string;
38+
}
39+
3840
// typescript for PROPS from StateRoute.tsx
3941
interface BarStackProps {
4042
width: number;
@@ -43,6 +45,13 @@ interface BarStackProps {
4345
hierarchy: any;
4446
}
4547

48+
interface snapshot {
49+
children: [];
50+
componentData: any;
51+
name: string;
52+
state: string;
53+
}
54+
4655
/* DEFAULTS */
4756
const margin = { top: 60, right: 30, bottom: 0, left: 50 };
4857
const axisColor = '#679DCA';
@@ -58,10 +67,6 @@ const tooltipStyles = {
5867

5968
// traverses a snapshot - returns object of rendering times OR component state types. Depends on 2nd arg
6069

61-
interface data {
62-
snapshotId?: string;
63-
}
64-
6570
const traverse = (snapshot, data: data = {}) => {
6671
if (!snapshot.children[0]) return;
6772
for (let i = 0; i < snapshot.children.length; i++) {
@@ -115,7 +120,7 @@ const PerformanceVisx = (props: BarStackProps) => {
115120

116121
const data = getPerfMetrics(snapshots, getSnapshotIds(hierarchy));
117122

118-
const keys = Object.keys(data[0]).filter(d => d !== 'snapshotId') as [];
123+
const keys = Object.keys(data[0]).filter(d => d !== 'snapshotId');
119124

120125
const allComponentStates = traverse(snapshots[0]);
121126

0 commit comments

Comments
 (0)