You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 1. We will only interested in components that are one of these types: Function Component, Class Component, Indeterminate Component or Context Provider.
130
+
* NOTE: this list of components may change depending on future use
131
+
* 2. If user use Next JS, filter out default NextJS components
132
+
* 3. If user use Remix JS, filter out default Remix components
133
+
*/
123
134
135
+
if(
136
+
!allowedComponentTypes.has(tag)||
137
+
nextJSDefaultComponent.has(componentName)||
138
+
remixDefaultComponents.has(componentName)
139
+
){
140
+
// -------------------TRAVERSE TO NEXT FIBERNODE------------------------
141
+
// If currentFiberNode has children, recurse on children
142
+
if(child)_createTree(child,tree);
143
+
144
+
// If currentFiberNode has siblings, recurse on siblings
145
+
if(sibling){
146
+
_createTree(sibling,tree);
147
+
}
148
+
// -------------RETURN THE TREE OUTPUT & PASS TO FRONTEND FOR RENDERING-------
149
+
returntree;
150
+
}
124
151
125
-
// --------------INITIALIZE OBJECT TO CONTAIN COMPONENT DATA---------------
152
+
// --------------INITIALIZE OBJECT TO CONTAIN COMPONENT DATA---------------
126
153
letnewState: any|{hooksState?: any[]}={};
127
154
letcomponentData: {
128
155
actualDuration?: number;
@@ -146,16 +173,8 @@ export default function createTree(currentFiberNode: Fiber): Tree {
146
173
letisStatefulComponent=false;
147
174
148
175
// ---------------APPEND PROP DATA FROM REACT DEV TOOL----------------------
149
-
// Check to see if the parent component has any state/props
150
-
if(
151
-
!nextJSDefaultComponent.has(componentName)&&
152
-
!remixDefaultComponents.has(componentName)&&
153
-
(tag===FunctionComponent||
154
-
tag===ClassComponent||
155
-
tag===IndeterminateComponent||
156
-
tag===ContextProvider)&&
157
-
memoizedProps
158
-
){
176
+
// Check to see if the parent component has any props
@@ -169,13 +188,10 @@ export default function createTree(currentFiberNode: Fiber): Tree {
169
188
}
170
189
171
190
// ------------APPEND CONTEXT DATA FROM REACT DEV TOOL----------------
172
-
173
191
// memoizedState
174
192
// Note: if user use ReactHook, memoizedState.memoizedState can be a falsy value such as null, false, ... => need to specify this data is not undefined
// If user uses Redux, context data will be stored in memoizedState of the Provider component => grab context object stored in the memoizedState
@@ -196,12 +212,7 @@ export default function createTree(currentFiberNode: Fiber): Tree {
196
212
// if user uses useContext hook, context data will be stored in memoizedProps.value of the Context.Provider component => grab context object stored in memoizedprops
197
213
// Different from other provider, such as Routes, BrowswerRouter, ReactRedux, ..., Context.Provider does not have a displayName
198
214
// TODO: need to render this context provider when user use useContext hook.
@@ -221,12 +232,7 @@ export default function createTree(currentFiberNode: Fiber): Tree {
221
232
// Check if node is a stateful class component when user use setState.
222
233
// If user use setState to define/manage state, the state object will be stored in stateNode.state => grab the state object stored in the stateNode.state
223
234
// Example: for tic-tac-toe demo-app: Board is a stateful component that use setState to store state data.
0 commit comments