From c4738705f0b8c2b0595abc25ab069a450831e561 Mon Sep 17 00:00:00 2001 From: Charles Zhao <charleszhao@silverhand.io> Date: Thu, 24 Aug 2023 15:43:14 +0800 Subject: [PATCH] fix(console): remove 'unhandledrejection' listener from ErrorBoundary (#4391) --- .../src/containers/ErrorBoundary/index.tsx | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/packages/console/src/containers/ErrorBoundary/index.tsx b/packages/console/src/containers/ErrorBoundary/index.tsx index 838dc2edc..94719453b 100644 --- a/packages/console/src/containers/ErrorBoundary/index.tsx +++ b/packages/console/src/containers/ErrorBoundary/index.tsx @@ -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;