Skip to content

Commit 7d5355c

Browse files
committed
check linechart runs twice for 2 line values
1 parent 781f2e7 commit 7d5355c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
File renamed without changes.

src/templates/App.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ class App extends Component {
2828
// Checks if the filename has changed at the endpoint
2929
const newFileHash = (file) => {
3030
const ogFile = localStorage.getItem('fileName');
31-
const ogArray = localStorage.getItem('statementTotals');
31+
// Check the array has at least 2 values to show on LineChart
32+
const ogArray = localStorage.getItem('statementTotals')
33+
? JSON.parse(localStorage.getItem('statementTotals')).length >= 2
34+
: false;
3235
// Make sure both localStorage items exist
3336
if (ogFile && ogArray) {
3437
localStorage.setItem('fileName', file);

0 commit comments

Comments
 (0)