fix: Fix display currectly after jumping from the error page
Fix display currectly after jumping from the error page Change-Id: I3ec80b38d7b4f330c7e65d4e54d6b70668bc6e0d
This commit is contained in:
parent
8dac045ee2
commit
1d4952cf60
@ -35,10 +35,22 @@ class Right extends Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps) {
|
||||||
|
const { location: { pathname: oldPath } = {} } = prevProps;
|
||||||
|
const { location: { pathname: newPath } = {} } = this.props;
|
||||||
|
if (oldPath !== newPath) {
|
||||||
|
this.updateErrorState(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static getDerivedStateFromError() {
|
static getDerivedStateFromError() {
|
||||||
return { hasError: true };
|
return { hasError: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidCatch(error, errorInfo) {
|
||||||
|
console.log(error, errorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
get isAdminPage() {
|
get isAdminPage() {
|
||||||
return this.props.isAdminPage || false;
|
return this.props.isAdminPage || false;
|
||||||
}
|
}
|
||||||
@ -56,6 +68,12 @@ class Right extends Component {
|
|||||||
return hasTab || false;
|
return hasTab || false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
updateErrorState(flag) {
|
||||||
|
this.setState({
|
||||||
|
hasError: flag,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
renderBreadcrumb = (currentRoutes = []) => {
|
renderBreadcrumb = (currentRoutes = []) => {
|
||||||
if (!currentRoutes || currentRoutes.length === 0) {
|
if (!currentRoutes || currentRoutes.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user