Skip to content

Commit 0561231

Browse files
Merge pull request #6 from oslabs-beta/cleaning
Cleaned up console logs used for debugging
2 parents 384a157 + 3a5db80 commit 0561231

File tree

14 files changed

+3
-71
lines changed

14 files changed

+3
-71
lines changed

src/app/components/Action.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ const Action = (props: ActionProps): JSX.Element => {
6060
logChangedState,
6161
} = props;
6262

63-
// console.log('index in Action.tsx', index);
64-
// console.log('logChangedState(index)', logChangedState(index));
65-
6663
/**
6764
* @function cleanTime: Displays render times for state changes
6865
* @returns render display time in seconds in miliseconds
@@ -138,7 +135,6 @@ const Action = (props: ActionProps): JSX.Element => {
138135
<button
139136
className="jump-button"
140137
onClick={(e: any): void => {
141-
console.log('componentData', componentData);
142138
e.stopPropagation();
143139
dispatch(changeSlider(index));
144140
dispatch(changeView(index));

src/app/components/ComponentMap.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ export default function ComponentMap({
285285
// mousing controls & Tooltip display logic
286286
const handleMouseAndClickOver = event => {
287287
() => dispatch(onHover(node.data.rtid));
288-
console.log('hover', node);
289288
const coords = localPoint(
290289
event.target.ownerSVGElement,
291290
event,

src/app/components/History.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ function History(props: Record<string, unknown>) {
103103
.append('g')
104104
.style('cursor', 'pointer')
105105
.on('click', d => {
106-
// console.log('d', d);
107106
dispatch(changeView(d.data.index));
108107
dispatch(changeSlider(d.data.index));
109108
})
@@ -183,12 +182,10 @@ function History(props: Record<string, unknown>) {
183182
return newObj;
184183
};
185184
// displays stateful data
186-
// console.log(index, index - 1);
187185

188186
const previousDisplay = statelessCleanning(snapshots[index - 1]);
189187
const delta = diff(previousDisplay, snapshots[index]);
190188
const changedState = findStateChangeObj(delta);
191-
// console.log('changedState in History.tsx', changedState[0]);
192189
// took out the formatting for History.tsx nodes, Rob 11/4
193190
const html = formatters.html.format(changedState[0]);
194191
// const output = ReactHtmlParser(html);

src/app/containers/ActionContainer.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function ActionContainer(props) {
2424
let actionsArr = [];
2525
const hierarchyArr: any[] = [];
2626

27-
// console.log('snapshots in ActionContainer.jsx', snapshots);
2827

2928
function findDiff(index) {
3029
const statelessCleanning = (obj: {
@@ -68,14 +67,10 @@ function ActionContainer(props) {
6867
};
6968
// displays stateful data
7069
const previousDisplay = statelessCleanning(snapshots[index - 1]);
71-
// console.log('this is previousDisplay', previousDisplay);
7270
const delta = diff(previousDisplay, snapshots[index]);
73-
// console.log('this is delta', delta);
7471
const changedState = findStateChangeObj(delta);
75-
// console.log('this is changedState in ActionContainer.tsx', changedState);
7672
const html = formatters.html.format(changedState[0]);
7773
const output = ReactHtmlParser(html);
78-
// console.log('this is output', output);
7974
return output;
8075
}
8176

@@ -105,7 +100,6 @@ function ActionContainer(props) {
105100
index: number;
106101
children?: [];
107102
}) => {
108-
// console.log('hello');
109103
if (
110104
obj.stateSnapshot.children.length > 0
111105
&& obj.stateSnapshot.children[0]
@@ -171,8 +165,6 @@ function ActionContainer(props) {
171165
componentData: { actualDuration: number } | undefined;
172166
},
173167
) => {
174-
// console.log('snapshots', snapshots);
175-
console.log('snapshot', snapshot);
176168
const { index } = snapshot;
177169
const selected = index === viewIndex;
178170
const last = viewIndex === -1 && index === hierarchyArr.length - 1;

src/app/containers/MainContainer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const mixpanel = require('mixpanel').init('12fa2800ccbf44a5c36c37bc9776e4c0', {
1818
debug: false,
1919
protocol: 'https',
2020
});
21-
console.log('store', useStoreContext);
2221
function MainContainer(): any {
2322
const [store, dispatch] = useStoreContext();
2423
const { tabs, currentTab, port: currentPort } = store;

src/app/reducers/mainReducer.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ export default (state, action) => produce(state, draft => {
1717
const findName = (index, obj) => {
1818
// eslint-disable-next-line eqeqeq
1919
if (obj && obj.index == index) {
20-
// obj.name = obj.index + 1
21-
// console.log('about to return');
2220
return obj.name;
2321
}
24-
// console.log('we returned why r u still here');
2522
const objChildArray = [];
2623
if (obj) {
2724
// eslint-disable-next-line no-restricted-syntax
@@ -88,11 +85,6 @@ export default (state, action) => produce(state, draft => {
8885
// finds the name by the newIndex parsing through the hierarchy to send to background.js the current name in the jump action
8986
const nameFromIndex = findName(newIndex, hierarchy);
9087

91-
// console.log('hierarchy', JSON.stringify(hierarchy));
92-
// console.log('snapshots', JSON.stringify(snapshots));
93-
// console.log('newIndex', newIndex);
94-
// console.log('nameFromIndex', nameFromIndex);
95-
// console.log('currentTab in slider', currentTab);
9688
port.postMessage({
9789
action: 'jumpToSnap',
9890
payload: snapshots[newIndex],
@@ -159,9 +151,7 @@ export default (state, action) => produce(state, draft => {
159151
// finds the name by the action.payload parsing through the hierarchy to send to background.js the current name in the jump action
160152
const nameFromIndex = findName(action.payload, hierarchy);
161153
// nameFromIndex is a number based on which jump button is pushed
162-
// console.log('action.payload', action.payload);
163-
// console.log('hierarchy', hierarchy);
164-
// console.log('hierarchy', JSON.stringify(hierarchy));
154+
165155
port.postMessage({
166156
action: 'jumpToSnap',
167157
payload: snapshots[action.payload],

src/app/store.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ import React, { useContext } from 'react';
33

44
export const StoreContext = React.createContext();
55

6-
export const useStoreContext:any = () => useContext(StoreContext);
7-
8-
// console.log('store in store', StoreContext);
6+
export const useStoreContext:any = () => useContext(StoreContext);

src/backend/helpers.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ export const getHooksNames = (elementType: string): Array<string> => {
7575
// Initialize empty object to store the setters and getter
7676
let ast: any;
7777
try {
78-
// console.log('hello');
7978
ast = JSXParser.parse(elementType);
80-
// console.log('ast1', ast);
8179
} catch (e) {
8280
return ['unknown'];
8381
}
@@ -86,10 +84,8 @@ export const getHooksNames = (elementType: string): Array<string> => {
8684

8785
// Begin search for hook names, only if ast has a body property.
8886
while (Object.hasOwnProperty.call(ast, 'body')) {
89-
// console.log('body', body);
9087
let tsCount = 0; // Counter for the number of TypeScript hooks seen (to distinguish in masterState)
9188
ast = ast.body;
92-
// console.log('ast.body', ast);
9389

9490
// Statements get all the names of the hooks. For example: useCount, useWildcard, ...
9591
const statements: Array<string> = [];
@@ -104,7 +100,6 @@ export const getHooksNames = (elementType: string): Array<string> => {
104100
// Traverse through the function's funcDecs and Expression Statements
105101
body.forEach((elem: any) => {
106102
// Hooks will always be contained in a variable declaration
107-
// console.log('elem', elem);
108103
if (elem.type === 'VariableDeclaration') {
109104
elem.declarations.forEach((hook: any) => {
110105
// Parse destructured statements pair
@@ -132,10 +127,8 @@ export const getHooksNames = (elementType: string): Array<string> => {
132127
}
133128
});
134129
statements.forEach((el, i) => {
135-
// console.log('in statements');
136130
if (el.match(/_use/)) hooksNames[el] = statements[i + 1];
137131
});
138-
// console.log('statements', statements);
139132
});
140133
return Object.values(hooksNames);
141134
}

src/backend/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const timeJump = timeJumpStart(snapShot, mode);
3333
window.addEventListener('message', ({ data: { action, payload } }: MsgData) => {
3434
switch (action) {
3535
case 'jumpToSnap':
36-
// console.log('payload', payload);
3736
timeJump(payload, true); // * This sets state with given payload
3837
// Get the pathname from payload and add new entry to browser history
3938
// MORE: https://developer.mozilla.org/en-US/docs/Web/API/History/pushState

src/backend/linkFiber.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,10 @@ function sendSnapshot(snap: Snapshot, mode: Mode): void {
9090
if (mode.jumping || mode.paused) return;
9191
// If there is no current tree creates a new one
9292
if (!snap.tree) {
93-
// console.log('in sendSnapshot');
9493
snap.tree = new Tree('root', 'root');
9594
}
96-
// console.log('cleantreecopy', snap);
9795
const payload = snap.tree.cleanTreeCopy();
98-
// if it's Recoil - run different actions?
96+
// if it's Recoil - run different actions
9997
if (isRecoil) {
10098
// getRecoilState()
10199
payload.atomsComponents = atomsComponents;
@@ -261,7 +259,6 @@ function createTree(
261259
// check to see if we can get the information we were looking for
262260
if (tag === 5) {
263261
try {
264-
// console.log(elementType.toString());
265262
if (memoizedProps.children[0]._owner.memoizedProps !== undefined) {
266263
const propsData = memoizedProps.children[0]._owner.memoizedProps;
267264
const newPropData = convertDataToString(propsData, tree.componentData.props ? tree.componentData.props : null);
@@ -271,7 +268,6 @@ function createTree(
271268
};
272269
}
273270
} catch (error) {
274-
// console.log('this is the error', error);
275271
}
276272
}
277273

@@ -390,15 +386,13 @@ function createTree(
390386
&& (tag === 0 || tag === 1 || tag === 2 || tag === 10)
391387
&& isRecoil === false
392388
) {
393-
// console.log('memoizedState', memoizedState);
394389
if (memoizedState.queue) {
395390
// Hooks states are stored as a linked list using memoizedState.next,
396391
// so we must traverse through the list and get the states.
397392
// We then store them along with the corresponding memoizedState.queue,
398393
// which includes the dispatch() function we use to change their state.
399394
const hooksStates = traverseHooks(memoizedState);
400395
const hooksNames = getHooksNames(elementType.toString());
401-
// console.log('hooksNames', hooksNames);
402396

403397
hooksStates.forEach((state, i) => {
404398
hooksIndex = componentActionsRecord.saveNew(
@@ -407,7 +401,6 @@ function createTree(
407401
);
408402
// why is this re-writing componentData.hooksIndex every time? instead, should remove from loop and try to re-write it to be whichever state is being updated
409403
componentData.hooksIndex = hooksIndex;
410-
// console.log('componentData.hooksIndex inside loop', componentData.hooksIndex);
411404
if (!newState) {
412405
newState = { hooksState: [] };
413406
// }
@@ -416,12 +409,8 @@ function createTree(
416409
}
417410
// newState[hooksNames[i]] = state.state;
418411
newState.hooksState.push({ [hooksNames[i]]: state.state });
419-
// console.log('newState.hooksState', newState.hooksState);
420412
componentFound = true;
421413
});
422-
// console.log('componentData.hooksIndex after', componentData.hooksIndex);
423-
// console.log('hooksStates', hooksStates);
424-
// console.log('hooksNames', hooksNames);
425414
}
426415
}
427416

@@ -498,7 +487,6 @@ function createTree(
498487
}
499488
// checking if tree fromSibling is true
500489
if (fromSibling) {
501-
// console.log('stateinfromSibling', newState);
502490
newNode = tree.addSibling(
503491
newState,
504492
elementType ? elementType.name : 'nameless',
@@ -551,13 +539,9 @@ export default (snap: Snapshot, mode: Mode): (() => void) => {
551539
return () => {
552540
// 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
553541
const devTools = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
554-
// console.log('devTools', devTools);
555542
const reactInstance = devTools ? devTools.renderers.get(1) : null;
556-
// console.log('reactInstance', reactInstance);
557543
// reactInstance returns an object of the react
558544
fiberRoot = devTools.getFiberRoots(1).values().next().value;
559-
// console.log('fiberRoot', fiberRoot);
560-
// console.log('snap', snap);
561545
const throttledUpdateSnapshot = throttle(
562546
() => {
563547
updateSnapShotTree(snap, mode);

0 commit comments

Comments
 (0)