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 });
} }
if (this.state.showPlayerStats == true) {
setTimeout(async () => { setTimeout(async () => {
await this.updateData(id); await this.updateData(id);
}, 10); // 10ms }, 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) {
if (this.state.showPlayerStats == true) {
setTimeout(async () => { setTimeout(async () => {
await this.updateData(this.state.id); await this.updateData(this.state.id);
}, 1000); // 1 second }, 1000); // 1 second
}
this.setState({ this.setState({
leftHand: { leftHand: {
averageCut: [15.0], averageCut: [15.0],