Acceptable state, but still issues when a lot of moves arrive quickly on several...
[vchess.git] / client / src / utils / gameStorage.js
index 2756496..2e78994 100644 (file)
@@ -62,7 +62,6 @@ export const GameStorage = {
   update: function(gameId, obj) {
     if (Number.isInteger(gameId) || !isNaN(parseInt(gameId))) {
       // corr: only move, fen and score
-console.log(obj.move);
       ajax("/games", "PUT", {
         gid: gameId,
         newObj: {
@@ -84,7 +83,7 @@ console.log(obj.move);
         objectStore.get(gameId).onsuccess = function(event) {
           // Ignoring error silently: shouldn't happen now. TODO?
           if (event.target.result) {
-            const game = event.target.result;
+            let game = event.target.result;
             Object.keys(obj).forEach(k => {
               if (k == "move") game.moves.push(obj[k]);
               else game[k] = obj[k];