@@ -38,6 +38,7 @@ import 'core-js';
3838// const componentActionsRecord = require('./masterState');
3939
4040import {
41+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
4142 Snapshot , Mode , ComponentData , HookStates , Fiber
4243} from './types/backendTypes' ;
4344import Tree from './tree' ;
@@ -114,7 +115,14 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
114115 } = currentFiber ;
115116
116117 let newState : any | { hooksState ?: any [ ] } = { } ;
117- let componentData : ComponentData = { } ;
118+ let componentData : {
119+ hooksState ?: any [ ] ,
120+ hooksIndex ?: number ,
121+ index ?: number ,
122+ actualDuration ?: number ,
123+ actualStartTime ?: number ,
124+ selfBaseDuration ?: number ,
125+ treeBaseDuration ?: number } = { } ;
118126 let componentFound = false ;
119127
120128 // Check if node is a stateful setState component
@@ -138,16 +146,14 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
138146 const hooksNames = getHooksNames ( elementType . toString ( ) ) ;
139147 hooksStates . forEach ( ( state , i ) => {
140148 hooksIndex = componentActionsRecord . saveNew ( state . state , state . component ) ;
149+ componentData . hooksIndex = hooksIndex ;
141150 if ( newState && newState . hooksState ) {
142- newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state , componentData : { index : hooksIndex } } ) ;
143- // newState.hooksState.push([{ [hooksNames[i]]: state.state }, hooksIndex]);
151+ newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state } ) ;
144152 } else if ( newState ) {
145- newState . hooksState = [ { [ hooksNames [ i ] ] : state . state , componentData : { index : hooksIndex } } ] ;
146- // newState.hooksState = [{ [hooksNames[i]]: state.state }, hooksIndex];
153+ newState . hooksState = [ { [ hooksNames [ i ] ] : state . state } ] ;
147154 } else {
148- // newState = { hooksState: [{ [hooksNames[i]]: state.state }, hooksIndex] };
149155 newState = { hooksState : [ ] } ;
150- newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state , componentData : { index : hooksIndex } } ) ;
156+ newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state } ) ;
151157 }
152158 componentFound = true ;
153159 } ) ;
@@ -232,7 +238,6 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
232238 const reactInstance = devTools ? devTools . renderers . get ( 1 ) : null ;
233239 fiberRoot = devTools . getFiberRoots ( 1 ) . values ( ) . next ( ) . value ;
234240 const throttledUpdateSnapshot = throttle ( updateSnapShotTree , 140 ) ;
235-
236241 document . addEventListener ( 'visibilitychange' , onVisibilityChange ) ;
237242 if ( reactInstance && reactInstance . version ) {
238243 devTools . onCommitFiberRoot = ( function ( original ) {
0 commit comments