Skip to content

Commit 12fb56c

Browse files
committed
remove comments and console logs
1 parent c1e9805 commit 12fb56c

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

src/backend/controllers/createTree.ts

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,47 @@ export default function createTree(currentFiberNode: Fiber): Tree {
152152
}
153153
}
154154

155-
155+
// COMMENT OUT SINCE EXTRACTING CONTEXT IS STILL IN EXPERIMENT
156+
// // ------------APPEND CONTEXT DATA FROM REACT DEV TOOL----------------
157+
// // memoizedState
158+
// // Note: if user use ReactHook, memoizedState.memoizedState can be a falsy value such as null, false, ... => need to specify this data is not undefined
159+
// if (
160+
// (tag === FunctionComponent || tag === ClassComponent || tag === IndeterminateComponent) &&
161+
// memoizedState?.memoizedState !== undefined
162+
// ) {
163+
// // If user uses Redux, context data will be stored in memoizedState of the Provider component => grab context object stored in the memoizedState
164+
// if (elementType.name === 'Provider') {
165+
// Object.assign(
166+
// componentData.context,
167+
// getStateAndContextData(memoizedState, elementType.name, _debugHookTypes),
168+
// );
169+
// }
170+
// // Else if user use ReactHook to define state => all states will be stored in memoizedState => grab all states stored in the memoizedState
171+
// // else {
172+
// // Object.assign(
173+
// // componentData.state,
174+
// // getStateAndContextData(memoizedState, elementType.name, _debugHookTypes),
175+
// // );
176+
// // }
177+
// }
178+
// // if user uses useContext hook, context data will be stored in memoizedProps.value of the Context.Provider component => grab context object stored in memoizedprops
179+
// // Different from other provider, such as Routes, BrowserRouter, ReactRedux, ..., Context.Provider does not have a displayName
180+
// // TODO: need to render this context provider when user use useContext hook.
181+
//
182+
//
183+
// if (tag === ContextProvider && !elementType._context.displayName) {
184+
// let stateData = memoizedProps.value;
185+
// if (stateData === null || typeof stateData !== 'object') {
186+
// stateData = { CONTEXT: stateData };
187+
// }
188+
// componentData.context = filterAndFormatData(stateData);
189+
// componentName = 'Context';
190+
// }
156191

157192
// ---------OBTAIN STATE & SET STATE METHODS FROM CLASS COMPONENT-----------
158193
// Check if currentFiberNode is a stateful class component when user use setState.
159194
// 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
160-
// Example: for tic-tac-toe demo-app: Board is a stateful component that use setState to store state data.
195+
// Example: for tic-tac-toe demo-app: Board is a stateful component that use setState to store stat
161196
if ((tag === ClassComponent || tag === IndeterminateComponent) && stateNode?.state) {
162197
// Save component's state and setState() function to our record for future time-travel state changing. Add record index to snapshot so we can retrieve.
163198
componentData.index = componentActionsRecord.saveNew(stateNode);

src/backend/routers/snapShot.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Snapshot, FiberRoot } from '../types/backendTypes';
22
import componentActionsRecord from '../models/masterState';
33
import routes from '../models/routes';
44
import createTree from '../controllers/createTree';
5-
const _ = require('lodash');
65

76
// -------------------------UPDATE & SEND TREE SNAP SHOT------------------------
87
/**
@@ -32,12 +31,7 @@ export default function updateAndSendSnapShotTree(fiberRoot: FiberRoot): void {
3231
// this will fire off everytime there is a change in test application
3332
// convert the payload from a fiber tree to an object to avoid a data clone error when postMessage processes the argument
3433
// compare payload and clonedDeepPayload with isIdentical
35-
// console.log('are they identical?', isIdentical(payload, clonedDeepPayload));
36-
// console.log('typeof payload', typeof payload);
3734
const obj = JSON.parse(JSON.stringify(payload));
38-
// console.log('righton, this is the obj: ', obj)
39-
// console.log('typeof obj', typeof obj);
40-
console.log('passing in obj');
4135
window.postMessage(
4236
{
4337
action: 'recordSnap',

0 commit comments

Comments
 (0)