Add showPlayerStats check when refreshing data

This commit is contained in:
Liam 2022-10-17 13:49:45 +01:00
parent ef73b96ad5
commit fcf0bb08d6

@ -107,9 +107,11 @@ export default class Overlay extends Component {
this.setState({ showPlayerStats: false }); this.setState({ showPlayerStats: false });
} }
setTimeout(async () => { if (this.state.showPlayerStats == true) {
await this.updateData(id); setTimeout(async () => {
}, 10); // 10ms await this.updateData(id);
}, 10); // 10ms
}
let shouldConnectSocket = false; let shouldConnectSocket = false;
@ -221,9 +223,11 @@ export default class Overlay extends Component {
* @param {boolean} visible Whether to show info other than the player stats * @param {boolean} visible Whether to show info other than the player stats
*/ */
async resetData(visible) { async resetData(visible) {
setTimeout(async () => { if (this.state.showPlayerStats == true) {
await this.updateData(this.state.id); setTimeout(async () => {
}, 1000); // 1 second await this.updateData(this.state.id);
}, 1000); // 1 second
}
this.setState({ this.setState({
leftHand: { leftHand: {
averageCut: [15.0], averageCut: [15.0],