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
@@ -63,7 +63,13 @@ import updateSnapShotTree from './snapShot';
63
63
64
64
// 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
65
65
// getHooksNames - helper function to grab the getters/setters from `elementType`
66
-
import{throttle,getHooksNames}from'./helpers';
66
+
import{throttle}from'./helpers';
67
+
import{
68
+
getHooksNames,
69
+
getHooksStateAndUpdateMethod,
70
+
getStateAndContextData,
71
+
filterAndFormatData,
72
+
}from'./statePropsExtractors';
67
73
68
74
// Set global variables to use in exported module and helper functions
69
75
declare global {
@@ -73,198 +79,6 @@ declare global {
73
79
}
74
80
}
75
81
76
-
// TODO: Determine what Component Data Type we are sending back for state, context, & props
77
-
typeReactimeData={
78
-
[key: string]: any;
79
-
};
80
-
81
-
/**
82
-
* @function traverseHooks
83
-
* @param memoizedState - The current state of the component associated with the current Fiber node.
84
-
* @return An array of array of HookStateItem objects
85
-
*
86
-
* Helper function to traverse through memoizedState and inject instrumentation to update our state tree
// ------------FILTER DATA FROM REACT DEV TOOL && CONVERT TO STRING-------------
176
-
/**
177
-
* This function receives raw Data from REACT DEV TOOL and filter the Data based on the exclude list. The filterd data is then converted to string (if applicable) before being send to reacTime front end.
178
-
*
179
-
* @param reactDevData - The data object obtained from React Devtool. Ex: memoizedProps, memoizedState
180
-
* @param reactimeData - The cached data from the current component. This can be data about states, context and/or props of the component.
181
-
* @returns The update component data object to send to front end of ReactTime
182
-
*/
183
-
functionconvertDataToString(
184
-
reactDevData: {[key: string]: any},
185
-
reactimeData: ReactimeData={},
186
-
): ReactimeData{
187
-
for(constkeyinreactDevData){
188
-
try{
189
-
// Skip keys that are in exclude set OR if there is no value at key
190
-
// Falsy values such as 0, false, null are still valid value
// Initialize object to store state and context data of the component
233
-
constreactimeData: ReactimeData={};
234
-
// Initialize counter for the default naming. If user use reactHook, such as useState, react will only pass in the value, and not the variable name of the state.
235
-
letstateCounter=1;
236
-
letrefCounter=1;
237
-
238
-
// Loop through each hook inside the _debugHookTypes array.
239
-
// NOTE: _debugHookTypes.length === height of memoizedState tree.
240
-
for(consthookof_debugHookTypes){
241
-
// useContext does not create any state => skip
242
-
if(hook==='useContext'){
243
-
continue;
244
-
}
245
-
// If user use useState reactHook => React will only pass in the value of state & not the name of the state => create a default name:
// If user use Redux to contain their context => the context object will be stored using useMemo Hook, as of for Rect Dev Tool v4.27.2
258
-
// Note: Provider is not a reserved component name for redux. User may name their component as Provider, which will break this logic. However, it is a good assumption that if user have a custom provider component, it would have a more specific naming such as ThemeProvider.
0 commit comments