From 4e9151ba3ce0859e66229aa6a38b0c37175f2c91 Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Tue, 31 Mar 2020 13:21:26 +0200 Subject: [PATCH] removed onError from state --- packages/core/src/layout/ErrorBoundary/ErrorBoundary.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/core/src/layout/ErrorBoundary/ErrorBoundary.tsx b/packages/core/src/layout/ErrorBoundary/ErrorBoundary.tsx index 97738ac761..34a903480e 100644 --- a/packages/core/src/layout/ErrorBoundary/ErrorBoundary.tsx +++ b/packages/core/src/layout/ErrorBoundary/ErrorBoundary.tsx @@ -18,12 +18,12 @@ import React, { ComponentClass, Component, SFC } from 'react'; type Props = { slackChannel: string; + onError?: (error: Error, errorInfo: string) => null; }; type State = { error?: Error; errorInfo?: string; - onError?: (error: Error, errorInfo: string) => null; }; const ErrorBoundary: ComponentClass< @@ -36,7 +36,6 @@ const ErrorBoundary: ComponentClass< this.state = { error: undefined, errorInfo: undefined, - onError: props.onError, }; } @@ -46,8 +45,8 @@ const ErrorBoundary: ComponentClass< this.setState({ error, errorInfo }); // Exposed for testing - if (this.state.onError) { - this.state.onError(error, errorInfo); + if (this.props.onError) { + this.props.onError(error, errorInfo); } }