Skip to content

Commit 07f4f35

Browse files
committed
removed redundant shapshot props from Map.tsx
1 parent fc3a35a commit 07f4f35

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/app/components/Map.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import React, { useState, useEffect } from 'react';
88
import * as d3 from 'd3';
99

1010
const Map = (props) => {
11-
12-
const { snapshot, snapshots} = props;
13-
const lastSnap = snapshots.length -1
11+
const { snapshots } = props;
12+
const lastSnap = snapshots.length - 1;
1413

1514
// set the heights and width of the tree to be passed into treeMap function
1615
const width: number = 900;
@@ -20,11 +19,10 @@ const Map = (props) => {
2019
const [{ x, y, k }, setZoomState]: any = useState({ x: 0, y: 0, k: 0 });
2120
useEffect(() => {
2221
setZoomState(d3.zoomTransform(d3.select('#canvas').node()));
23-
}, [snapshot.children]);
22+
}, [snapshots[lastSnap]]);
2423

2524
// Create D3 Tree Diagram
2625
useEffect(() => {
27-
2826
document.getElementById('canvas').innerHTML = '';
2927

3028
// creating the main svg container for d3 elements
@@ -136,11 +134,11 @@ const Map = (props) => {
136134
// allows the canvas to be zoom-able
137135
// d3 zoom functionality
138136
let zoom = d3.zoom().on('zoom', zoomed);
139-
svgContainer.call(
140-
zoom.transform,
141-
// Changes the initial view, (left, top)
142-
d3.zoomIdentity.translate(150, 250).scale(0.2)
143-
);
137+
// svgContainer.call(
138+
// zoom.transform,
139+
// // Changes the initial view, (left, top)
140+
// d3.zoomIdentity.translate(150, 250).scale(0.2)
141+
// );
144142
// allows the canvas to be zoom-able
145143
svgContainer.call(
146144
d3
@@ -168,6 +166,9 @@ const Map = (props) => {
168166
function dragEnded(): any {
169167
g.attr('cursor', 'grab');
170168
}
169+
170+
171+
171172
});
172173

173174
return (

src/app/components/StateRoute.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const StateRoute = (props: StateRouteProps) => {
4343
//Test Map
4444
const renderMap = () => {
4545
if (hierarchy) {
46-
return <Map snapshot={snapshot} snapshots={snapshots} />;
46+
return <Map snapshots={snapshots} />;
4747
}
4848
return <div className="noState">{NO_STATE_MSG}</div>;
4949
};
@@ -83,7 +83,7 @@ const StateRoute = (props: StateRouteProps) => {
8383
/>
8484
);
8585
}
86-
86+
8787
//This will intermitently block Recoil PerfCharts from rendering
8888
// else {
8989
// perfChart = (

0 commit comments

Comments
 (0)