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
// Every time a state change is made in the accompanying app, the extension creates a
215
-
// Tree “snapshot” of the current state, and adds it to the current “cache” of snapshots in the extension
214
+
// -------------------------CREATE TREE TO SEND TO FRONT END--------------------
215
+
/**
216
+
* Every time a state change is made in the accompanying app, the extension creates a Tree “snapshot” of the current state, and adds it to the current “cache” of snapshots in the extension
217
+
*/
216
218
functioncreateTree(
217
219
currentFiber: Fiber,
218
220
tree: Tree=newTree('root','root'),
@@ -240,14 +242,15 @@ function createTree(
240
242
_debugHookTypes,
241
243
}=currentFiber;
242
244
243
-
// check to see if we can get the information we were looking for
244
-
// need to figure out what tag is
245
+
// Tag === 5 signify this is a React Fragment. Each JSX component return a React fragment
245
246
if(tag===5){
246
247
try{
248
+
// Ensure parent component has memoizedProps property
* @interface DevTools - A global object provided by the React Developer Tools extension. It provides a set of methods that allow developers to inspect and manipulate React components in the browser.
397
399
*/
@@ -401,17 +403,22 @@ interface DevTools {
401
403
*/
402
404
renderers: Map<1,undefined|{version: string}>;
403
405
/**
404
-
* @method getFiberRoots - a method that return a fiber root {set}
405
-
* @param renderID - the ID of the node???
406
-
* @return A set of fiber root.
406
+
* @method getFiberRoots - get the Set of fiber roots that are currently mounted for the given rendererID. If not found, initalize a new empty Set at renderID key.
407
+
* @param renderID - a unique identifier for a specific instance of a React renderer. When a React application is first mounted, it will receive a rendererID. This rendererID will remain the same for the entire lifecycle of the application, even if the state is updated and the components are re-rendered/unmounted/added. However, if the application is unmounted and re-mounted again, it will receive a new rendererID.
408
+
* @return A set of fiberRoot.
407
409
*/
408
-
getFiberRoots: (renderID: number)=>Set<number>;
410
+
getFiberRoots: (rendererID: number)=>Set<number>;
409
411
410
-
onCommitFiberRoot: any;
412
+
/**
413
+
* @method onCommitFiberRoot - After the state of a component in a React Application is updated, the virtual DOM will be updated. When a render has been commited for a root, onCommitFiberRoot will be invoked to determine if the component is being mounted, updated, or unmounted. After that, this method will send update information to the React DevTools to update its UI to reflect the change.
414
+
* @param rendererID - a unique identifier for a specific instance of a React renderer
415
+
* @param root - root of the rendered tree (a.k.a the root of the React Application)
// react devtools global hook is a global object that was injected by the React Devtools content script, allows access to fiber nodes and react version
Copy file name to clipboardExpand all lines: src/backend/types/backendTypes.ts
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -136,6 +136,25 @@ export const Block = 22;
136
136
exportconstOffscreenComponent=23;
137
137
exportconstLegacyHiddenComponent=24;
138
138
139
+
/**
140
+
* @type Fiber - The Fiber data structure that React uses to represent a component tree.
141
+
* @member actualDuration - The time taken to render the current Fiber node and its descendants during the previous render cycle. This value is used to optimize the rendering of components and to provide performance metrics to developers.
142
+
* @member actualStartTime - The time at which the rendering of the current Fiber node started during the previous render cycle.
143
+
* @member child - Pointer to the first child.
144
+
* @member dependencies - An array of values (such as state or props) that the current Fiber node depends on. This is used to determine whether the node needs to be re-rendered.
145
+
* @member elementType - The type of the current Fiber node's element (e.g. the component function or class, or the DOM element type). Example: div, h1,
146
+
* @member index - Index of the current Fiber node. Ex: if a div has 3 headings. The first child is heading with index = 0. The next sibling is a heading with index = 1 & the last sibling is a heading with index = 2.
147
+
* @member key - Unique identifier of this child, used to identify the node when rendering lists of components.
148
+
* @member memoizedProps - The current props of the component associated with the current Fiber node.
149
+
* @member memoizedState - The current state of the component associated with the current Fiber node.
150
+
* @member selfBaseDuration - The base duration of the current Fiber node's render phase (excluding the time taken to render its children). This field is only set when the enableProfilerTimer flag is enabled.
151
+
* @member sibling - Pointer to next sibling
152
+
* @member stateNode - The local state associated with this fiber.
153
+
* @member tag - The type of the current Fiber node, such as FunctionComponent, ClassComponent, or HostComponent (for DOM elements).
154
+
* @member treeBaseDuration - The total base duration of the current Fiber node's subtree. This field is only set when the enableProfilerTimer flag is enabled.
155
+
* @member type - Same as elementType.
156
+
* @member _debugHookTypes - An array of hooks used for debugging purposes.
0 commit comments