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
* This is a recursive function that runs after Fiber commit, if user navigating to a new route during jumping. This function performs the following logic:
18
+
* This is a recursive function that runs after Fiber commit, if user is navigating to a new route during jumping. This function performs the following logic:
24
19
* 1. Traverse from FiberRootNode
25
20
* 2. If the component is stateful, extract its update methods & push to the `componentActionRecord` array
* 1. We will only interested in components that are one of these types: Function Component, Class Component, Indeterminate Component or Context Provider.
47
+
* 1. We are only interested in components that are one of these types: Function Component, Class Component, Indeterminate Component or Context Provider.
68
48
* NOTE: this list of components may change depending on future use
69
-
* 2. If user use Next JS, filter out default NextJS components
70
-
* 3. If user use Remix JS, filter out default Remix components
49
+
* 2. If user is using Next JS, filter out default NextJS components
50
+
* 3. If user is using Remix JS, filter out default Remix components
71
51
*/
72
52
73
53
if(
@@ -90,20 +70,15 @@ export default function createComponentActionsRecord(currentFiberNode: Fiber): v
90
70
// ---------OBTAIN STATE & SET STATE METHODS FROM CLASS COMPONENT-----------
91
71
// Check if node is a stateful class component when user use setState.
92
72
// 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
93
-
// Example: for tic-tac-toe demo-app: Board is a stateful component that use setState to store state data.
// Save component setState() method to our componentActionsRecord for use during timeJump
96
75
componentActionsRecord.saveNew(stateNode);
97
76
}
98
-
99
77
// --------OBTAIN STATE & DISPATCH METHODS FROM FUNCTIONAL COMPONENT--------
100
78
// Check if node is a stateful class component when user use setState.
101
79
// If user use useState to define/manage state, the state object will be stored in memoizedState.queue => grab the state object stored in the memoizedState.queue
102
80
if(
103
-
(tag===FunctionComponent||
104
-
tag===IndeterminateComponent||
105
-
//TODO: Need to figure out why we need context provider
// Save component's state and dispatch() function to our record for future time-travel state changing. Add record index to snapshot so we can retrieve.
92
+
// Save component's state and dispatch() function to our record for future time-travel state changing. Add record index to snapshot so we can retrieve later
118
93
componentActionsRecord.saveNew(component);
119
94
});
120
95
}catch(err){
@@ -124,7 +99,6 @@ export default function createComponentActionsRecord(currentFiberNode: Fiber): v
124
99
}
125
100
}
126
101
}
127
-
128
102
// ---------------------TRAVERSE TO NEXT FIBERNODE--------------------------
129
103
// If currentFiberNode has children, recurse on children
0 commit comments