Fixed an issue with connecting to the socket

This commit is contained in:
Liam 2022-10-03 08:49:57 +01:00
parent 3f0b2d9306
commit f215d44ed0

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