@@ -111,16 +111,8 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
111111 treeBaseDuration,
112112 } = currentFiber ;
113113
114- let newState : any ;
114+ let newState : any = { } ;
115115 let componentData : ComponentData = { } ;
116- /* = {
117- index: -1,
118- actualDuration: 0,
119- actualStartTime: 0,
120- selfBaseDuration: 0,
121- treeBaseDuration: 0,
122- };
123- */
124116 let componentFound = false ;
125117
126118 // Check if node is a stateful setState component
@@ -144,16 +136,14 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
144136 const hooksNames = getHooksNames ( elementType . toString ( ) ) ;
145137 hooksStates . forEach ( ( state , i ) => {
146138 hooksIndex = componentActionsRecord . saveNew ( state . state , state . component ) ;
139+ componentData . hooksIndex = hooksIndex ;
147140 if ( newState && newState . hooksState ) {
148- newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state , componentData : { index : hooksIndex } } ) ;
149- // newState.hooksState.push([{ [hooksNames[i]]: state.state }, hooksIndex]);
141+ newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state } ) ;
150142 } else if ( newState ) {
151- newState . hooksState = [ { [ hooksNames [ i ] ] : state . state , componentData : { index : hooksIndex } } ] ;
152- // newState.hooksState = [{ [hooksNames[i]]: state.state }, hooksIndex];
143+ newState . hooksState = [ { [ hooksNames [ i ] ] : state . state } ] ;
153144 } else {
154- // newState = { hooksState: [{ [hooksNames[i]]: state.state }, hooksIndex] };
155145 newState = { hooksState : [ ] } ;
156- newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state , componentData : { index : hooksIndex } } ) ;
146+ newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state } ) ;
157147 }
158148 componentFound = true ;
159149 } ) ;
@@ -188,7 +178,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
188178 elementType ? elementType . name : 'nameless' ,
189179 componentData ) ;
190180 }
191- if ( newState !== 'stateless' ) console . log ( 'state updated:' , newState ) ;
181+ // if (newState !== 'stateless') console.log('state updated:', newState);
192182 } else {
193183 newNode = tree ;
194184 }
@@ -221,7 +211,6 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
221211
222212 function onVisibilityChange ( ) : void {
223213 doWork = ! document . hidden ;
224- // console.log('doWork is:', doWork);
225214 }
226215
227216 return ( ) => {
@@ -241,19 +230,18 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
241230 const reactInstance = devTools ? devTools . renderers . get ( 1 ) : null ;
242231 fiberRoot = devTools . getFiberRoots ( 1 ) . values ( ) . next ( ) . value ;
243232 const throttledUpdateSnapshot = throttle ( updateSnapShotTree , 140 ) ;
244-
245233 document . addEventListener ( 'visibilitychange' , onVisibilityChange ) ;
246234 if ( reactInstance && reactInstance . version ) {
247235 devTools . onCommitFiberRoot = ( function ( original ) {
248236 return function ( ...args ) {
249237 // eslint-disable-next-line prefer-destructuring
250238 fiberRoot = args [ 1 ] ;
251- console . log ( 'in CFR committed fiber' ) ;
239+ // console.log('in CFR committed fiber');
252240 if ( doWork ) {
253- console . log ( 'in CFR: updating snapshot' ) ;
241+ // console.log('in CFR: updating snapshot');
254242 throttledUpdateSnapshot ( ) ;
255243 }
256- console . log ( 'in CFR updated snapshot' ) ;
244+ // console.log('in CFR updated snapshot');
257245 return original ( ...args ) ;
258246 } ;
259247 } ( devTools . onCommitFiberRoot ) ) ;
0 commit comments