Skip to content

Commit

Permalink
Avoid INCG spam by overwriting existing incomplete games
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Mar 22, 2019
1 parent 8c07d8f commit 70e7fc5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/views/games/gamesStore.js
Expand Up @@ -41,7 +41,14 @@ export default {
},
incomplete(state, data) {
// params: ["gameId", "players", "scores", "clicks", "lastActive"]
state.incompleteGames.push(data);
let existingIndex = state.incompleteGames.indexOf(
game => game.gameId === data.gameId
);
if (existingIndex) {
state.incompleteGames[existingIndex] = data;
} else {
state.incompleteGames.push(data);
}
},
mapData(state, data) {
let game = state.activeGames[data.gameId];
Expand Down

0 comments on commit 70e7fc5

Please sign in to comment.