Skip to content

Commit

Permalink
Merge pull request #32 from fhlavac/main
Browse files Browse the repository at this point in the history
  • Loading branch information
fhlavac authored Aug 30, 2023
2 parents 6f4073b + ef54424 commit cd4c27d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/module/src/ErrorBoundary/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,24 @@ class ErrorBoundary extends React.Component<React.PropsWithChildren<ErrorPagePro
return { hasError: true, error, historyState: history.state };
}

render() {

updateState = () => {
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;
Expand Down

0 comments on commit cd4c27d

Please sign in to comment.