diff --git a/src/components/GameList.js b/src/components/GameList.js index 390b70b3b689d075ed87b6ecac05af2e3514975e..39fa691620896b8cfa6bf422f80f6962c3118d6e 100644 --- a/src/components/GameList.js +++ b/src/components/GameList.js @@ -23,9 +23,10 @@ class GameList extends React.Component { fetch(`${process.env.REACT_APP_URL}/game/listgames`) .then(response => response.json()) .then(games => { + let selectedGame = this.state.selectedGame !== undefined ? this.state.selectedGame : undefined; this.setState({ games: games, - selectedGame: games !== undefined && games[0].id + selectedGame: selectedGame !== undefined ? selectedGame : games !== undefined ? games[0].id : undefined }); }) .catch(error => {