1+ /* eslint-disable react/no-array-index-key */
2+ /* eslint-disable react/prop-types */
13/* eslint-disable jsx-a11y/click-events-have-key-events */
24/* eslint-disable no-nested-ternary */
35/* eslint-disable no-unused-expressions */
46/* eslint-disable jsx-a11y/no-static-element-interactions */
57/* eslint-disable no-restricted-syntax */
68/* eslint-disable guard-for-in */
7- // @ts -nocheck
9+
810import React , { useState , useEffect } from 'react' ;
911import { Group } from '@visx/group' ;
1012import { hierarchy , Tree } from '@visx/hierarchy' ;
@@ -32,6 +34,7 @@ export type LinkTypesProps = {
3234 height : number ;
3335 margin ?: { top : number ; right : number ; bottom : number ; left : number } ;
3436 snapshots : Record < string , unknown > ;
37+ currentSnapshot ?: Record < string , unknown >
3538} ;
3639
3740export default function ComponentMap ( {
@@ -55,8 +58,8 @@ export default function ComponentMap({
5558 } , [ dispatch ] ) ;
5659
5760 // 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 ;
6063
6164 let origin : { x : number ; y : number } ;
6265 let sizeWidth : number ;
@@ -122,9 +125,9 @@ export default function ComponentMap({
122125 overflowWrap : 'break-word' ,
123126 } ;
124127
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 ` ;
128131 } ;
129132
130133 const formatProps = data => {
@@ -172,7 +175,7 @@ export default function ComponentMap({
172175 collectNodes ( currentSnapshot ) ;
173176
174177 // find the node that has been selected and use it as the root
175- const startNode = null ;
178+ let startNode = null ;
176179 let rootNode ;
177180 const findSelectedNode = ( ) => {
178181 for ( const node of nodeList ) {
@@ -215,7 +218,7 @@ export default function ComponentMap({
215218 />
216219 < Group top = { margin . top } left = { margin . left } >
217220 < Tree
218- root = { hierarchy ( startNode || data , d => ( d . isExpanded ? d . children : null ) ) }
221+ root = { hierarchy ( startNode , d => ( d . isExpanded ? d . children : null ) ) }
219222 size = { [ sizeWidth , sizeHeight ] }
220223 separation = { ( a , b ) => ( a . parent === b . parent ? 1 : 0.5 ) / a . depth }
221224 >
@@ -332,7 +335,6 @@ export default function ComponentMap({
332335 ? 'white'
333336 : '#161521'
334337 }
335- z
336338 >
337339 { node . data . name }
338340 </ text >
@@ -374,7 +376,7 @@ export default function ComponentMap({
374376 State:
375377 { formatState ( tooltipData . state ) }
376378 </ div >
377- < div style = { scrollStyle } >
379+ < div style = { React . scrollStyle } >
378380 < div className = "props" >
379381 Props:
380382 { formatProps ( tooltipData . componentData . props ) }
0 commit comments