@@ -111,21 +111,8 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
111111 treeBaseDuration,
112112 } = currentFiber ;
113113
114- < < < << << HEAD
115114 let newState : any = { } ;
116115 let componentData : ComponentData = { } ;
117- = === ===
118- let newState : any ;
119- let componentData : ComponentData = { } ;
120- /* = {
121- index: -1,
122- actualDuration: 0,
123- actualStartTime: 0,
124- selfBaseDuration: 0,
125- treeBaseDuration: 0,
126- };
127- */
128- > >>> >>> master
129116 let componentFound = false ;
130117
131118 // Check if node is a stateful setState component
@@ -149,16 +136,14 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
149136 const hooksNames = getHooksNames ( elementType . toString ( ) ) ;
150137 hooksStates . forEach ( ( state , i ) => {
151138 hooksIndex = componentActionsRecord . saveNew ( state . state , state . component ) ;
139+ componentData . hooksIndex = hooksIndex ;
152140 if ( newState && newState . hooksState ) {
153- newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state , componentData : { index : hooksIndex } } ) ;
154- // newState.hooksState.push([{ [hooksNames[i]]: state.state }, hooksIndex]);
141+ newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state } ) ;
155142 } else if ( newState ) {
156- newState . hooksState = [ { [ hooksNames [ i ] ] : state . state , componentData : { index : hooksIndex } } ] ;
157- // newState.hooksState = [{ [hooksNames[i]]: state.state }, hooksIndex];
143+ newState . hooksState = [ { [ hooksNames [ i ] ] : state . state } ] ;
158144 } else {
159- // newState = { hooksState: [{ [hooksNames[i]]: state.state }, hooksIndex] };
160145 newState = { hooksState : [ ] } ;
161- newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state , componentData : { index : hooksIndex } } ) ;
146+ newState . hooksState . push ( { [ hooksNames [ i ] ] : state . state } ) ;
162147 }
163148 componentFound = true ;
164149 } ) ;
@@ -182,10 +167,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
182167
183168 let newNode = null ;
184169 // We want to add this fiber node to the snapshot
185- < < < << << HEAD
186- = === ===
187170 // const snapshotState = newState.state || newState.hooksState;
188- >>> >>> > master
189171 if ( componentFound || newState === 'stateless' ) {
190172 if ( fromSibling ) {
191173 newNode = tree . addSibling ( newState ,
@@ -196,7 +178,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
196178 elementType ? elementType . name : 'nameless' ,
197179 componentData ) ;
198180 }
199- if ( newState !== 'stateless' ) console . log ( 'state updated:' , newState ) ;
181+ // if (newState !== 'stateless') console.log('state updated:', newState);
200182 } else {
201183 newNode = tree ;
202184 }
@@ -229,10 +211,6 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
229211
230212 function onVisibilityChange ( ) : void {
231213 doWork = ! document . hidden ;
232- << < < < << HEAD
233- === = ===
234- // console.log('doWork is:', doWork);
235- >>> > >>> master
236214 }
237215
238216 return ( ) => {
@@ -252,19 +230,18 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
252230 const reactInstance = devTools ? devTools . renderers . get ( 1 ) : null ;
253231 fiberRoot = devTools . getFiberRoots ( 1 ) . values ( ) . next ( ) . value ;
254232 const throttledUpdateSnapshot = throttle ( updateSnapShotTree , 140 ) ;
255-
256233 document . addEventListener ( 'visibilitychange' , onVisibilityChange ) ;
257234 if ( reactInstance && reactInstance . version ) {
258235 devTools . onCommitFiberRoot = ( function ( original ) {
259236 return function ( ...args ) {
260237 // eslint-disable-next-line prefer-destructuring
261238 fiberRoot = args [ 1 ] ;
262- console . log ( 'in CFR committed fiber' ) ;
239+ // console.log('in CFR committed fiber');
263240 if ( doWork ) {
264- console . log ( 'in CFR: updating snapshot' ) ;
241+ // console.log('in CFR: updating snapshot');
265242 throttledUpdateSnapshot ( ) ;
266243 }
267- console . log ( 'in CFR updated snapshot' ) ;
244+ // console.log('in CFR updated snapshot');
268245 return original ( ...args ) ;
269246 } ;
270247 } ( devTools . onCommitFiberRoot ) ) ;
0 commit comments