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:
parent
2d83a29e5f
commit
c4738705f0
1 changed files with 0 additions and 18 deletions
|
@ -35,24 +35,6 @@ class ErrorBoundary extends Component<Props, State> {
|
||||||
|
|
||||||
public state: 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() {
|
render() {
|
||||||
const { children, t } = this.props;
|
const { children, t } = this.props;
|
||||||
const { error } = this.state;
|
const { error } = this.state;
|
||||||
|
|
Loading…
Reference in a new issue