'update'
authorBenjamin Auder <benjamin.auder@somewhere>
Sat, 4 Apr 2020 17:43:27 +0000 (19:43 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Sat, 4 Apr 2020 17:43:27 +0000 (19:43 +0200)
client/src/utils/compgameStorage.js
client/src/utils/gameStorage.js

index 655fd6b..4f5181e 100644 (file)
@@ -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]);
index 99206ed..6885ed1 100644 (file)
@@ -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;