From fd2a344391c940c41cb7065928e74e872dcd2e3c Mon Sep 17 00:00:00 2001 From: Ev Bogue Date: Thu, 4 Apr 2019 09:57:51 -0500 Subject: fix bug where log did not update when it did not exist --- app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 668f4b2..5ad1547 100644 --- a/app.js +++ b/app.js @@ -143,7 +143,13 @@ function route () { // contact new items from the log onto the client's log of everything var num = serverData.log.length - clientLog.log.length var diff = serverData.log.slice(0, num) - var oldLog = JSON.parse(localStorage['log']) + + if (localStorage['log']) { + var oldLog = JSON.parse(localStorage['log']) + } else { + var oldLog = [] + } + var newLog = diff.concat(oldLog) localStorage['log'] = JSON.stringify(newLog) -- cgit v1.2.3-70-g09d2