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
// throttle returns a function that can be called any number of times (possibly in quick succession) but will only invoke the callback at most once every x ms
24
+
//getHooksNames - helper function to grab the getters/setters from `elementType`
// Don't send messages while jumping or while paused
73
62
if(mode.jumping||mode.paused)return;
63
+
// If there is no current tree creates a new one
74
64
if(!snap.tree){
75
65
snap.tree=newTree('root','root');
76
66
}
77
67
constpayload=snap.tree.cleanTreeCopy();
78
-
68
+
// if it's Recoil - run different actions?
79
69
if(isRecoil){
80
-
// getRecoilState();
81
70
payload.atomsComponents=atomsComponents;
82
71
payload.atomSelectors=atomsSelectors;
83
72
payload.recoilDomNode=recoilDomNode
84
73
}
85
-
74
+
//method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it spawned, or between a page and an iframe embedded within it.
//Every React application has one or more DOM elements that act as containers. React creates a fiber root object for each of those containers. This fiber root is where React holds the reference to a fiber tree. It is stored in the current property of the fiber root
103
95
if(fiberRoot){
104
96
const{ current }=fiberRoot;
97
+
//Clears circular component table
105
98
circularComponentTable.clear();
99
+
//creates snapshot that is a tree based on properties in fiberRoot object
* @param memoizedProps Property containing props on a stateful fctnl component's FiberNode object
115
110
* @return An array of array of HookStateItem objects (state and component properties)
116
111
*/
112
+
113
+
// if type of state - Recoil hooks
117
114
functiontraverseRecoilHooks(
115
+
//State of the fiber that was used to create the output. When processing updates it reflects the state that’s currently rendered on the screen.
118
116
memoizedState: any,
117
+
//Props of the fiber that were used to create the output during the previous render.
119
118
memoizedProps: any
120
119
): HookStates{
121
120
consthooksStates: HookStates=[];
@@ -177,6 +176,8 @@ function traverseHooks(memoizedState: any): HookStates {
177
176
letatomsSelectors={};
178
177
letatomsComponents={};
179
178
179
+
// Every time a state change is made in the accompanying app, the extension creates a
180
+
// Tree “snapshot” of the current state, and adds it to the current “cache” of snapshots in the extension
180
181
functioncreateTree(
181
182
currentFiber: Fiber,
182
183
tree: Tree=newTree('root','root'),
@@ -195,6 +196,7 @@ function createTree(
195
196
sibling,
196
197
stateNode,
197
198
child,
199
+
//with memoizedState we can grab the root type and construct an Abstract Syntax Tree from the hooks structure using Acorn in order to extract the hook getters and match them with their corresponding setters in an object
0 commit comments