Skip to content

Commit cd4c27d

Browse files
authored
Merge pull request #32 from fhlavac/main
2 parents 6f4073b + ef54424 commit cd4c27d

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

packages/module/src/ErrorBoundary/ErrorBoundary.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,24 @@ class ErrorBoundary extends React.Component<React.PropsWithChildren<ErrorPagePro
4141
return { hasError: true, error, historyState: history.state };
4242
}
4343

44-
render() {
45-
44+
updateState = () => {
4645
if (this.state.historyState !== history.state) {
4746
this.setState({
4847
hasError: false,
4948
historyState: history.state,
5049
});
5150
}
51+
};
52+
53+
componentDidUpdate(): void {
54+
this.updateState();
55+
}
5256

57+
componentDidMount(): void {
58+
this.updateState();
59+
}
60+
61+
render() {
5362
if (this.state.hasError) {
5463
if (this.props.silent) {
5564
return null;

0 commit comments

Comments
 (0)