1
+ /* eslint-disable react/no-array-index-key */
2
+ /* eslint-disable react/prop-types */
1
3
/* eslint-disable jsx-a11y/click-events-have-key-events */
2
4
/* eslint-disable no-nested-ternary */
3
5
/* eslint-disable no-unused-expressions */
4
6
/* eslint-disable jsx-a11y/no-static-element-interactions */
5
7
/* eslint-disable no-restricted-syntax */
6
8
/* eslint-disable guard-for-in */
7
- // @ts -nocheck
9
+
8
10
import React , { useState , useEffect } from 'react' ;
9
11
import { Group } from '@visx/group' ;
10
12
import { hierarchy , Tree } from '@visx/hierarchy' ;
@@ -32,6 +34,7 @@ export type LinkTypesProps = {
32
34
height : number ;
33
35
margin ?: { top : number ; right : number ; bottom : number ; left : number } ;
34
36
snapshots : Record < string , unknown > ;
37
+ currentSnapshot ?: Record < string , unknown >
35
38
} ;
36
39
37
40
export default function ComponentMap ( {
@@ -55,8 +58,8 @@ export default function ComponentMap({
55
58
} , [ dispatch ] ) ;
56
59
57
60
// setting the margins for the Map to render in the tab window.
58
- const innerWidth = totalWidth - margin . left - margin . right ;
59
- const innerHeight = totalHeight - margin . top - margin . bottom - 60 ;
61
+ const innerWidth : number = totalWidth - margin . left - margin . right ;
62
+ const innerHeight : number = totalHeight - margin . top - margin . bottom - 60 ;
60
63
61
64
let origin : { x : number ; y : number } ;
62
65
let sizeWidth : number ;
@@ -122,9 +125,9 @@ export default function ComponentMap({
122
125
overflowWrap : 'break-word' ,
123
126
} ;
124
127
125
- const formatRenderTime = time => {
126
- time = time . toFixed ( 3 ) ;
127
- return `${ time } ms ` ;
128
+ const formatRenderTime = ( time : number ) : string => {
129
+ const renderTime = time . toFixed ( 3 ) ;
130
+ return `${ renderTime } ms ` ;
128
131
} ;
129
132
130
133
const formatProps = data => {
@@ -172,7 +175,7 @@ export default function ComponentMap({
172
175
collectNodes ( currentSnapshot ) ;
173
176
174
177
// find the node that has been selected and use it as the root
175
- const startNode = null ;
178
+ let startNode = null ;
176
179
let rootNode ;
177
180
const findSelectedNode = ( ) => {
178
181
for ( const node of nodeList ) {
@@ -215,7 +218,7 @@ export default function ComponentMap({
215
218
/>
216
219
< Group top = { margin . top } left = { margin . left } >
217
220
< Tree
218
- root = { hierarchy ( startNode || data , d => ( d . isExpanded ? d . children : null ) ) }
221
+ root = { hierarchy ( startNode , d => ( d . isExpanded ? d . children : null ) ) }
219
222
size = { [ sizeWidth , sizeHeight ] }
220
223
separation = { ( a , b ) => ( a . parent === b . parent ? 1 : 0.5 ) / a . depth }
221
224
>
@@ -332,7 +335,6 @@ export default function ComponentMap({
332
335
? 'white'
333
336
: '#161521'
334
337
}
335
- z
336
338
>
337
339
{ node . data . name }
338
340
</ text >
@@ -374,7 +376,7 @@ export default function ComponentMap({
374
376
State:
375
377
{ formatState ( tooltipData . state ) }
376
378
</ div >
377
- < div style = { scrollStyle } >
379
+ < div style = { React . scrollStyle } >
378
380
< div className = "props" >
379
381
Props:
380
382
{ formatProps ( tooltipData . componentData . props ) }
0 commit comments