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
@@ -171,15 +170,13 @@ function History(props: Record<string, unknown>): JSX.Element {
171
170
constmakeD3Tree=()=>{
172
171
constsvg=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.
173
172
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.
// function that takes in data and turns it into a d3 tree.
177
175
consttreeRoot=d3.hierarchy(data);// 'd3.hierarchy' constructs a root node from the specified hierarchical data.
178
176
returnd3.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.
179
177
};
180
178
181
179
constd3root=tree(root);// create a d3. tree from our root
182
-
console.log('d3root: ',d3root);
183
180
constcurrNode=labelCurrentNode(d3root);// iterate through our nodes and apply a color property
184
181
185
182
constg=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 {
314
311
};
315
312
316
313
useEffect(()=>{
317
-
console.log('currLocation: ',currLocation);
318
314
makeD3Tree();
319
315
},[root/*, currLocation*/]);// if the 'root' or 'currLocation' changes, re-build the D3 Tree
Copy file name to clipboardExpand all lines: src/app/containers/ErrorContainer.tsx
+10-35Lines changed: 10 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -23,14 +23,7 @@ function ErrorContainer(props: ErrorContainerProps): JSX.Element {
23
23
consttitleTracker=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
24
24
consttimeout=useRef(null);
25
25
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
+
34
27
// function that launches the main app
35
28
functionlaunch(): void{
36
29
dispatch(launchContentScript(tabs[currentTab]));
@@ -58,17 +51,16 @@ function ErrorContainer(props: ErrorContainerProps): JSX.Element {
58
51
// hook that sets timer while waiting for a snapshot from the background script, resets if the tab changes/reloads
// '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
// '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
+
constloadingArrayClone=[...loadingArray];
60
+
loadingArrayClone[i]=value;
61
+
setLoading(loadingArrayClone);
62
+
}
70
63
}
71
-
}
72
64
73
65
if(titleTracker.current!==currentTitle){
74
66
// 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 {
0 commit comments