From cc25444a44669a7deb6c096c1195f320d17590a1 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Sat, 4 Apr 2020 19:43:27 +0200 Subject: [PATCH] 'update' --- client/src/utils/compgameStorage.js | 2 +- client/src/utils/gameStorage.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/client/src/utils/compgameStorage.js b/client/src/utils/compgameStorage.js index 655fd6bf..4f5181ef 100644 --- a/client/src/utils/compgameStorage.js +++ b/client/src/utils/compgameStorage.js @@ -55,7 +55,7 @@ export const CompgameStorage = { .objectStore("compgames"); objectStore.get(gameId).onsuccess = function(event) { // Ignoring error silently: shouldn't happen now. TODO? - if (event.target.result) { + if (!!event.target.result) { const game = event.target.result; Object.keys(obj).forEach(k => { if (k == "move") game.moves.push(obj[k]); diff --git a/client/src/utils/gameStorage.js b/client/src/utils/gameStorage.js index 99206ede..6885ed15 100644 --- a/client/src/utils/gameStorage.js +++ b/client/src/utils/gameStorage.js @@ -73,14 +73,13 @@ export const GameStorage = { // obj: chat, move, fen, clocks, score[Msg], initime, ... update: function(gameId, obj) { - // live dbOperation((err, db) => { let objectStore = db .transaction("games", "readwrite") .objectStore("games"); objectStore.get(gameId).onsuccess = function(event) { // Ignoring error silently: shouldn't happen now. TODO? - if (event.target.result) { + if (!!event.target.result) { let game = event.target.result; // Hidden tabs are delayed, to prevent multi-updates: if (obj.moveIdx < game.moves.length) return; -- 2.44.0