@@ -181,13 +181,29 @@ function createTree(
181181 actualStartTime,
182182 selfBaseDuration,
183183 treeBaseDuration,
184+ dependencies,
185+ _debugHookTypes,
184186 } = currentFiber ;
185187
188+ // if (currentFiber.tag === 10) {
189+ // const queue = [currentFiber];
190+ // while (queue.length > 0) {
191+ // const tempFiber = queue.shift();
192+ // if (tempFiber.tag === 0) console.log(tempFiber);
193+ // if (tempFiber.sibling) {
194+ // queue.push(tempFiber.sibling);
195+ // }
196+ // if (tempFiber.child) {
197+ // queue.push(tempFiber.child);
198+ // }
199+ // }
200+ // }
201+
186202// check to see if we can get the information we were looking for
187203// need to figure out what tag is
188204 if ( tag === 5 ) {
189205 try {
190- if ( memoizedProps . children [ 0 ] . _owner ?. memoizedProps !== undefined ) {
206+ if ( memoizedProps . children && memoizedProps . children [ 0 ] ? ._owner ?. memoizedProps !== undefined ) {
191207 const propsData = memoizedProps . children [ 0 ] . _owner . memoizedProps ;
192208 const newPropData = convertDataToString ( propsData , tree . componentData . props ? tree . componentData . props : null ) ;
193209 tree . componentData = {
@@ -210,6 +226,7 @@ function createTree(
210226 selfBaseDuration ?: number ;
211227 treeBaseDuration ?: number ;
212228 props ?: any ,
229+ context ?: any ,
213230 } = { } ;
214231 let componentFound = false ;
215232
@@ -218,6 +235,10 @@ function createTree(
218235 componentData . props = convertDataToString ( memoizedProps , null ) ;
219236 }
220237
238+ // if the component uses the useContext hook, we want to grab the co text object and add it to the componentData object for that fiber
239+ if ( tag === 0 && _debugHookTypes ) {
240+ componentData . context = convertDataToString ( dependencies ?. firstContext ?. memoizedValue , null ) ;
241+ }
221242 // Check if node is a stateful class component
222243 if ( stateNode && stateNode . state && ( tag === 0 || tag === 1 || tag === 2 ) ) {
223244 // Save component's state and setState() function to our record for future
@@ -245,6 +266,7 @@ function createTree(
245266 const hooksStates = traverseHooks ( memoizedState ) ;
246267 const hooksNames = getHooksNames ( elementType . toString ( ) ) ;
247268
269+
248270 hooksStates . forEach ( ( state , i ) => {
249271 hooksIndex = componentActionsRecord . saveNew (
250272 state . state ,
0 commit comments