Added same mounting fix to the main page

This commit is contained in:
Liam 2022-10-19 19:43:21 +01:00
parent 3c42a7ac60
commit ed0d1b05ec
2 changed files with 9 additions and 6 deletions

@ -25,6 +25,7 @@ export default class Home extends Component {
constructor(props) {
super(props);
this._mounted = false;
this.state = {
loading: true,
steamId: undefined,
@ -44,6 +45,11 @@ export default class Home extends Component {
}
async componentDidMount() {
if (this._mounted === true) {
return;
}
this._mounted = true;
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());

@ -12,8 +12,8 @@ export default class Overlay extends Component {
constructor(props) {
super(props);
this._mounted = false;
this._mounted = false;
this.state = {
hasError: false,
@ -44,8 +44,8 @@ export default class Overlay extends Component {
},
rightHand: {
averageCut: [15.0],
averagePreSwing: [70.0],
averagePostSwing: [30.0],
averagePreSwing: [70.0],dd
averagePostSwing: [30.0],d
},
};
this.setupTimer();
@ -128,7 +128,6 @@ export default class Overlay extends Component {
// Handle Errors
static getDerivedStateFromError(error) {
console.log(error);
return this.setState({ hasError: true });
}
componentDidCatch(error, errorInfo) {
@ -210,8 +209,6 @@ export default class Overlay extends Component {
async validateSteamId(id) {
const data = await fetch(`/api/validateid?steamid=${id}`);
const json = await data.json();
console.log(json);
return json.message === "Valid" ? true : false;
}