Skip to content

Commit 7330f9e

Browse files
committed
deleted console logs
1 parent e0ec5e1 commit 7330f9e

File tree

10 files changed

+21
-216
lines changed

10 files changed

+21
-216
lines changed

src/app/components/App.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { MemoryRouter as Router } from 'react-router-dom';
2+
import { MemoryRouter as Router } from 'react-router-dom';
33
import MainContainer from '../containers/MainContainer';
44
import { ThemeProvider } from '@mui/material/styles';
55
import theme from './theme';
@@ -15,7 +15,6 @@ function App(): JSX.Element {
1515
<ThemeProvider theme={theme}>
1616
<Router>
1717
{/* we wrap our application with the <Router> tag so that all components that are nested will have the react-router context */}
18-
{console.log('App reloaded', new Date().toLocaleString())}
1918
<MainContainer />
2019
</Router>
2120
</ThemeProvider>

src/app/components/StateRoute/History.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ function History(props: Record<string, unknown>): JSX.Element {
4242

4343
const svgRef = React.useRef(null);
4444
const root = JSON.parse(JSON.stringify(hierarchy)); // why do we stringify and then parse our hierarchy back to JSON? (asked 7/31/23)
45-
console.log('history root: ', root);
4645
// setting the margins for the Map to render in the tab window.
4746
const innerWidth: number = totalWidth - margin.left - margin.right;
4847
const innerHeight: number = totalHeight - margin.top - margin.bottom - 60;
@@ -171,15 +170,13 @@ function History(props: Record<string, unknown>): JSX.Element {
171170
const makeD3Tree = () => {
172171
const svg = d3.select(svgRef.current); // d3.select Selects the first element/node that matches svgRef.current. If no element/node match returns an empty selection. If multiple elements/nodes match the selector, only the first matching element/node (in document order) will be selected.
173172
svg.selectAll('*').remove(); // Selects all elements. The elements will be selected in document order (top-to-bottom). We then remove the selected elements/nodes from the DOM. This is important as to ensure that the SVG is empty before rendering the D3 based visualization to avoid interference/overlap with any previously rendered content.
174-
console.log('makeD3Tree initial svgRef: ', svgRef);
175173
const tree = (data) => {
176174
// function that takes in data and turns it into a d3 tree.
177175
const treeRoot = d3.hierarchy(data); // 'd3.hierarchy' constructs a root node from the specified hierarchical data.
178176
return d3.tree().size([innerWidth, innerHeight])(treeRoot); // d3.tree creates a new tree layout with a size option of innerWidth (~line 41) and innerHeight (~line 42). We specify our new tree layout's root as 'treeRoot' which assigns an x and y property to each node to represent an [x, y] coordinate system.
179177
};
180178

181179
const d3root = tree(root); // create a d3. tree from our root
182-
console.log('d3root: ', d3root);
183180
const currNode = labelCurrentNode(d3root); // iterate through our nodes and apply a color property
184181

185182
const g = svg //serves as a container for the nodes and links within the D3 Visualization of the tree
@@ -314,7 +311,6 @@ function History(props: Record<string, unknown>): JSX.Element {
314311
};
315312

316313
useEffect(() => {
317-
console.log('currLocation: ', currLocation);
318314
makeD3Tree();
319315
}, [root /*, currLocation*/]); // if the 'root' or 'currLocation' changes, re-build the D3 Tree
320316

src/app/components/StateRoute/PerformanceVisx/PerformanceVisx.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ const PerformanceVisx = (props: PerformanceVisxProps): JSX.Element => {
193193
const [route, setRoute] = useState('All Routes');
194194
const [snapshot, setSnapshot] = useState('All Snapshots');
195195

196-
console.log('Performance tab has loaded!');
197-
198196
getActions();
199197

200198
useEffect(() => {
@@ -246,7 +244,6 @@ const PerformanceVisx = (props: PerformanceVisxProps): JSX.Element => {
246244
const renderForTutorial = () => {
247245
// This will redirect to the proper tabs during the tutorial
248246
// Updated redirect to Navigate v23 redirect no longer supported in react router dom after v6
249-
console.log(currentTabInApp);
250247
if (currentTabInApp === 'performance') return <Navigate to='/performance/' />;
251248
if (currentTabInApp === '/performance-comparison')
252249
return <Navigate to='/performance/comparison' />;

src/app/components/SwitchApp.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const SwitchAppDropdown = (): JSX.Element => {
1818
const { currentTab, tabs }: MainState = useSelector((state: RootState) => state.main);
1919

2020
const tabsArray: {}[] = []; // tabsArray is an empty array that will take objects as it's elements
21-
console.log('switchAppDropdown; currentTab: ', currentTab, 'tabs: ', tabs);
2221
Object.keys(tabs).forEach((tab) => {
2322
// We populate our 'tabsArray' with objects derived from the 'tab' that is currently being iterated on.
2423
tabsArray.unshift({ value: tab, label: tabs[tab].title });

src/app/containers/ErrorContainer.tsx

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,7 @@ function ErrorContainer(props: ErrorContainerProps): JSX.Element {
2323
const titleTracker = useRef(currentTitle); // useRef returns an object with a property 'initialValue' and a value of whatever was passed in. This allows us to reference a value that's not needed for rendering
2424
const timeout = useRef(null);
2525
const { port } = props;
26-
console.log(
27-
'ErrorContainer state variables: tabs status: ',
28-
JSON.stringify(tabs[currentTab]?.status),
29-
'currentTab: ',
30-
currentTab,
31-
'currentTitle: ',
32-
currentTitle,
33-
);
26+
3427
// function that launches the main app
3528
function launch(): void {
3629
dispatch(launchContentScript(tabs[currentTab]));
@@ -58,17 +51,16 @@ function ErrorContainer(props: ErrorContainerProps): JSX.Element {
5851
// hook that sets timer while waiting for a snapshot from the background script, resets if the tab changes/reloads
5952
useEffect(() => {
6053
if (tabs[currentTab])
61-
console.log('ErrorContainer useEffect fired, ', JSON.stringify(tabs[currentTab]?.status));
62-
// We declare a function
63-
function setLoadingArray(i: number, value: boolean) {
64-
// 'setLoadingArray' checks an element in our 'loadingArray' local state and compares it with passed in boolean argument. If they don't match, we update our local state replacing the selected element with the boolean argument
65-
if (loadingArray[i] !== value) {
66-
// this conditional helps us avoid unecessary state changes if the element and the value are already the same
67-
const loadingArrayClone = [...loadingArray];
68-
loadingArrayClone[i] = value;
69-
setLoading(loadingArrayClone);
54+
// We declare a function
55+
function setLoadingArray(i: number, value: boolean) {
56+
// 'setLoadingArray' checks an element in our 'loadingArray' local state and compares it with passed in boolean argument. If they don't match, we update our local state replacing the selected element with the boolean argument
57+
if (loadingArray[i] !== value) {
58+
// this conditional helps us avoid unecessary state changes if the element and the value are already the same
59+
const loadingArrayClone = [...loadingArray];
60+
loadingArrayClone[i] = value;
61+
setLoading(loadingArrayClone);
62+
}
7063
}
71-
}
7264

7365
if (titleTracker.current !== currentTitle) {
7466
// if the current tab changes/reloads, we reset loadingArray to it's default [true, true, true]
@@ -102,23 +94,6 @@ function ErrorContainer(props: ErrorContainerProps): JSX.Element {
10294
timeout.current = setTimeout(() => {
10395
setLoadingArray(1, false);
10496
}, 3000); // increased from 1500
105-
// let devTools;
106-
// while (!devTools) {
107-
// devTools = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
108-
// }
109-
// console.log('ErrorContainer react devtools: ', devTools);
110-
// // If React Devtools is not installed, object will be undefined.
111-
// if (!devTools) return;
112-
// // If React Devtools is installed, send a message to front end.
113-
114-
// console.log('ErrorContainer react devtools check passed');
115-
// status.reactDevToolsInstalled = true;
116-
117-
// console.log('ErrorContainer attempting reinitialize');
118-
// port.postMessage({
119-
// action: 'reinitialize',
120-
// tabId: currentTab,
121-
// });
12297
setLoadingArray(1, false);
12398
}
12499
if (loadingArray[1] === false && status.reactDevToolsInstalled === true) {

src/app/containers/MainContainer.tsx

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,6 @@ function MainContainer(): JSX.Element {
2828
const dispatch = useDispatch();
2929

3030
const { currentTab, tabs, port }: MainState = useSelector((state: RootState) => state.main);
31-
console.log(
32-
'Redux state at render: ',
33-
useSelector((state: RootState) => state.main),
34-
);
35-
console.log(
36-
'MainContainer state at render: tabs: ',
37-
JSON.stringify(tabs[currentTab]?.status),
38-
// tabs[currentTab]?.status,
39-
'port: ',
40-
port?.name,
41-
'time: ',
42-
new Date().toLocaleString(),
43-
);
4431
//JR: check connection status
4532
const { connectionStatus }: MainState = useSelector((state: RootState) => state.main);
4633

@@ -88,16 +75,6 @@ function MainContainer(): JSX.Element {
8875
// const { action, payload, sourceTab } = message;
8976
let maxTab: number;
9077

91-
console.log(
92-
'MainContainer received message inside of the port messageListener. action: ',
93-
action,
94-
'payload: ',
95-
// @ts-ignore
96-
JSON.stringify(payload[Object.keys(payload)[0]]?.status),
97-
payload,
98-
'sourceTab: ',
99-
sourceTab,
100-
);
10178
if (!sourceTab && action !== 'keepAlive') {
10279
// if the sourceTab doesn't exist or is 0 and it is not a 'keepAlive' action
10380
const tabsArray: Array<string> = Object.keys(payload); // we create a tabsArray of strings composed of keys from our payload object
@@ -148,18 +125,11 @@ function MainContainer(): JSX.Element {
148125

149126
// useEffect(() => {
150127
async function awaitPortConnection() {
151-
console.log('MainContainer state view of port at start of useEffect: ', port);
152128
if (port) return; // only open port once so if it exists, do not run useEffect again
153129

154130
// Connect ot port and assign evaluated result (obj) to currentPort
155131
const currentPort = await chrome.runtime.connect({ name: 'panel' });
156132

157-
// JR: why are we removing the listener just to readd it? logging here
158-
// console.log('messageListener before removing: ', messageListener);
159-
// console.log(
160-
// 'currentPort hasListener? before removing: ',
161-
// currentPort.onMessage.hasListener(messageListener),
162-
// );
163133
// If messageListener exists on currentPort, remove it
164134
while (currentPort.onMessage.hasListener(messageListener))
165135
currentPort.onMessage.removeListener(messageListener);

src/app/slices/mainSlice.ts

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ export const mainSlice = createSlice({
4141
const { tabs, currentTab, port } = state;
4242

4343
port.postMessage({ action: 'emptySnap', tabId: currentTab }); //communicate with background.js (service worker)
44-
console.log('emptySnapshots tabs: ', tabs);
45-
console.log('emptySnapshots currentTab: ', currentTab);
4644
// properties associated with timetravel + seek bar
4745
tabs[currentTab].sliderIndex = 0;
4846
tabs[currentTab].viewIndex = 0;
@@ -103,9 +101,6 @@ export const mainSlice = createSlice({
103101
tabs[currentTab] || {};
104102
const { payload } = action;
105103

106-
console.log('mainSlice initialConnect reducer fired, ', payload),
107-
'time: ',
108-
new Date().toLocaleString();
109104
Object.keys(payload).forEach((tab) => {
110105
// check if tab exists in memory
111106
// add new tab
@@ -138,33 +133,13 @@ export const mainSlice = createSlice({
138133
setTab: (state, action) => {
139134
const { tabs, currentTab } = state;
140135
const { mode } = tabs[currentTab] || {};
141-
// console.log(
142-
// 'mode test. mode exists? ',
143-
// !!mode,
144-
// 'optional chained mode return value: ',
145-
// mode?.paused,
146-
// );
147-
console.log(
148-
'mainSlice setTab reducer received a payload. mode: ',
149-
JSON.stringify(mode),
150-
'payload: ',
151-
action.payload,
152-
);
153136
if (!mode?.paused) {
154137
if (typeof action.payload === 'number') {
155138
state.currentTab = action.payload;
156139
return;
157140
} else if (typeof action.payload === 'object') {
158141
state.currentTab = action.payload.tabId;
159142
if (action.payload?.title) state.currentTitle = action.payload.title;
160-
console.log(
161-
'mainSlice setTab successful! state.currentTab: ',
162-
state.currentTab,
163-
'state.currentTitle: ',
164-
state.currentTitle,
165-
'state.tabs[currentTab].status: ',
166-
JSON.stringify(state.tabs[currentTab]?.status),
167-
);
168143
return;
169144
}
170145
}
@@ -180,15 +155,8 @@ export const mainSlice = createSlice({
180155

181156
if (tabs[currentTab]) {
182157
const { reactDevToolsInstalled } = payload[currentTab].status;
183-
console.log(reactDevToolsInstalled);
184158
// JR 12.20. 9.47pm this was not applying to state before
185159
state.tabs[currentTab].status.reactDevToolsInstalled = reactDevToolsInstalled;
186-
console.log(
187-
'devTools updated state: ',
188-
JSON.stringify(state.tabs[currentTab].status),
189-
'time: ',
190-
new Date().toLocaleString(),
191-
);
192160
}
193161
},
194162

@@ -197,15 +165,8 @@ export const mainSlice = createSlice({
197165
const { tabs, currentTab } = state;
198166

199167
if (tabs[currentTab]) {
200-
console.log(tabs[currentTab], payload[currentTab]);
201168
// JR 12.20. 9.47pm this was not applying to state before
202169
state.tabs[currentTab].status.targetPageisaReactApp = true;
203-
console.log(
204-
'aReactApp updated state: ',
205-
JSON.stringify(state.tabs[currentTab].status),
206-
'time: ',
207-
new Date().toLocaleString(),
208-
);
209170
}
210171
},
211172

@@ -230,19 +191,8 @@ export const mainSlice = createSlice({
230191

231192
changeView: (state, action) => {
232193
const { tabs, currentTab } = state;
233-
console.log(
234-
'changeView tabs: ',
235-
JSON.stringify(tabs),
236-
'currentTab: ',
237-
currentTab,
238-
'tabs[currentTab]: ',
239-
tabs[currentTab],
240-
);
241-
console.log(tabs);
242-
console.log('changeView state: ', state);
243194
const { viewIndex } = tabs[currentTab] || {};
244-
console.log('changeView viewIndex: ', viewIndex);
245-
console.log('changeView action.payload: ', action.payload);
195+
246196
// unselect view if same index was selected
247197
tabs[currentTab].viewIndex = viewIndex === action.payload ? -1 : action.payload;
248198
},
@@ -268,7 +218,6 @@ export const mainSlice = createSlice({
268218

269219
setCurrentTabInApp: (state, action) => {
270220
state.currentTabInApp = action.payload;
271-
console.log('mainSlice currentTabInApp: ', state.currentTabInApp);
272221
},
273222

274223
pause: (state) => {
@@ -398,7 +347,6 @@ export const mainSlice = createSlice({
398347
toggleMode: (state, action) => {
399348
const { port, tabs, currentTab } = state;
400349
const { mode } = tabs[currentTab] || {};
401-
console.log('toggleMode current mode destructured from tabs[currentTab]: ', mode);
402350
mode[action.payload] = !mode[action.payload];
403351
const newMode = mode[action.payload];
404352
let actionText;

src/backend/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import timeJumpInitialization from './controllers/timeJump';
1212
import { Snapshot, Status, MsgData } from './types/backendTypes';
1313
import routes from './models/routes';
1414

15-
console.log('backend script successfully injected ', new Date().toLocaleString())
16-
1715
// -------------------------INITIALIZE MODE--------------------------
1816
/** Indicate if mode is jumping/not jumping or navigating during jumping */
1917
const mode: Status = {
@@ -42,7 +40,6 @@ linkFiberInit();
4240
* 3. If not navigate during jumping => invoke timeJump to update ReactFiber tree with cached data from the snapshot payload
4341
*/
4442
window.addEventListener('message', async ({ data: { action, payload } }: MsgData) => {
45-
console.log('index.ts window event listener data received: ', action, payload);
4643
switch (action) {
4744
case 'jumpToSnap':
4845
// Set mode to jumping to prevent snapShot being sent to frontEnd
@@ -60,7 +57,7 @@ window.addEventListener('message', async ({ data: { action, payload } }: MsgData
6057
await timeJump(payload); // * This sets state with given payload
6158
}
6259
break;
63-
case 'reinitialize':
60+
// case 'reinitialize':
6461
// console.log('backend reinitialize received, performing checks again');
6562
// let devTools;
6663
// while (!devTools) {
@@ -102,4 +99,4 @@ window.addEventListener('message', async ({ data: { action, payload } }: MsgData
10299
default:
103100
break;
104101
}
105-
});
102+
});

0 commit comments

Comments
 (0)