@@ -188,25 +188,30 @@ function convertDataToString(
188
188
reactimeData : ReactimeData = { } ,
189
189
) : ReactimeData {
190
190
for ( const key in reactDevData ) {
191
- // Skip keys that are in exclude set OR if there is no value at key
192
- // Falsy values such as 0, false, null are still valid value
193
- if ( exclude . has ( key ) || reactDevData [ key ] === undefined ) {
194
- continue ;
195
- }
196
- // If value at key is a function, assign key with value 'function' to reactimeData object
197
- else if ( typeof reactDevData [ key ] === 'function' ) {
198
- reactimeData [ key ] = 'function' ;
199
- }
200
- // If value at key is an object/array and not null => JSON stringify the value
201
- else if ( typeof reactDevData [ key ] === 'object' && reactDevData [ key ] !== null ) {
202
- reactimeData [ key ] = JSON . stringify ( reactDevData [ key ] ) ;
203
- }
204
- // Else assign the primitive value
205
- else {
206
- reactimeData [ key ] = reactDevData [ key ] ;
191
+ try {
192
+ // Skip keys that are in exclude set OR if there is no value at key
193
+ // Falsy values such as 0, false, null are still valid value
194
+ if ( exclude . has ( key ) || reactDevData [ key ] === undefined ) {
195
+ continue ;
196
+ }
197
+ // If value at key is a function, assign key with value 'function' to reactimeData object
198
+ else if ( typeof reactDevData [ key ] === 'function' ) {
199
+ reactimeData [ key ] = 'function' ;
200
+ }
201
+ // If value at key is an object/array and not null => JSON stringify the value
202
+ else if ( typeof reactDevData [ key ] === 'object' && reactDevData [ key ] !== null ) {
203
+ reactimeData [ key ] = JSON . stringify ( reactDevData [ key ] ) ;
204
+ }
205
+ // Else assign the primitive value
206
+ else {
207
+ reactimeData [ key ] = reactDevData [ key ] ;
208
+ }
209
+ } catch ( err ) {
210
+ console . log ( 'linkFiber' , { reactDevData, key } ) ;
211
+ throw Error ( `Error caught at converDataToString: ${ err } ` ) ;
207
212
}
213
+ return reactimeData ;
208
214
}
209
- return reactimeData ;
210
215
}
211
216
// ------------------------FILTER STATE & CONTEXT DATA--------------------------
212
217
/**
@@ -368,7 +373,13 @@ export function createTree(
368
373
369
374
// ----------------APPEND PROP DATA FROM REACT DEV TOOL-----------------------
370
375
// check to see if the parent component has any state/props
371
- if ( memoizedProps ) {
376
+ if (
377
+ ( tag === FunctionComponent ||
378
+ tag === ClassComponent ||
379
+ tag === IndeterminateComponent ||
380
+ tag === ContextProvider ) &&
381
+ memoizedProps
382
+ ) {
372
383
Object . assign ( componentData . props , convertDataToString ( memoizedProps ) ) ;
373
384
}
374
385
@@ -448,6 +459,7 @@ export function createTree(
448
459
const hooksNames = getHooksNames ( elementType . toString ( ) ) ;
449
460
console . log ( { hooksNames } ) ;
450
461
newState . hooksState = [ ] ;
462
+ componentData . state = { } ;
451
463
hooksStates . forEach ( ( state , i ) => {
452
464
hooksIndex = componentActionsRecord . saveNew ( state . state , state . component ) ;
453
465
componentData . hooksIndex = hooksIndex ;
0 commit comments