0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(console): remove 'unhandledrejection' listener from ErrorBoundary (#4391)

This commit is contained in:
Charles Zhao 2023-08-24 15:43:14 +08:00 committed by GitHub
parent 2d83a29e5f
commit c4738705f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,24 +35,6 @@ class ErrorBoundary extends Component<Props, State> {
public state: State = {};
promiseRejectionHandler(error: unknown) {
this.setState(
ErrorBoundary.getDerivedStateFromError(
error instanceof Error ? error : new Error(String(error))
)
);
}
componentDidMount(): void {
window.addEventListener('unhandledrejection', (event) => {
this.promiseRejectionHandler(event.reason);
});
}
componentWillUnmount(): void {
window.removeEventListener('unhandledrejection', this.promiseRejectionHandler);
}
render() {
const { children, t } = this.props;
const { error } = this.state;