errorBoundary fix

This commit is contained in:
hyunwoo93.cha
2024-08-13 16:11:06 +09:00
parent a91abbd4a8
commit a5c2ea754c

View File

@@ -16,19 +16,20 @@ class ErrorBoundary extends Component {
componentDidCatch(error, errorInfo) {
console.error("Uncaught error:", error, errorInfo);
this.handleError();
}
componentDidUpdate(prevProps, prevState) {
if (this.state.hasError) {
clearLaunchParams();
if (typeof window === "object") {
window.location.reload();
}
handleError = () => {
clearLaunchParams();
if (typeof window === "object") {
window.location.reload();
}
}
};
render() {
if (this.state.hasError) {
return <div>Something went wrong.</div>;
return <div>Something went wrong. Reloading...</div>;
}
return this.props.children;