From e470816501ea7e911f30a0d4cb91611df85b9611 Mon Sep 17 00:00:00 2001 From: Filip Hlavac Date: Wed, 30 Aug 2023 11:11:26 +0200 Subject: [PATCH] Remove setState call from ErrorBoundary render fn --- packages/module/src/ErrorBoundary/ErrorBoundary.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/module/src/ErrorBoundary/ErrorBoundary.tsx b/packages/module/src/ErrorBoundary/ErrorBoundary.tsx index b991e091..9a35a509 100644 --- a/packages/module/src/ErrorBoundary/ErrorBoundary.tsx +++ b/packages/module/src/ErrorBoundary/ErrorBoundary.tsx @@ -41,15 +41,24 @@ class ErrorBoundary extends React.Component { if (this.state.historyState !== history.state) { this.setState({ hasError: false, historyState: history.state, }); } + }; + + componentDidUpdate(): void { + this.updateState(); + } + componentDidMount(): void { + this.updateState(); + } + + render() { if (this.state.hasError) { if (this.props.silent) { return null;