diff --git a/pages/index.js b/pages/index.js index bb0e890..a16d5d5 100644 --- a/pages/index.js +++ b/pages/index.js @@ -101,15 +101,22 @@ export default class Home extends Component { this.setState({ showPlayerStats: false }); } + let shouldConnectSocket = false; + // Check if the player wants to show their current score information if (params.scoreinfo === 'true') { this.setState({ showScore: true }); - this.connectSocket(); + shouldConnectSocket = true; } // Check if the player wants to show the current song if (params.songinfo === 'true') { this.setState({ showSongInfo: true }); + shouldConnectSocket = true; + } + + if (shouldConnectSocket) { + this.connectSocket(); } await this.updateData(id);