From f215d44ed093f39486e0f51c5f836f8f173887e5 Mon Sep 17 00:00:00 2001 From: Liam <67254223+RealFascinated@users.noreply.github.com> Date: Mon, 3 Oct 2022 08:49:57 +0100 Subject: [PATCH] Fixed an issue with connecting to the socket --- pages/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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);