diff --git a/src/layouts/Base/Right.jsx b/src/layouts/Base/Right.jsx index 1f505e4b..9575c3ee 100644 --- a/src/layouts/Base/Right.jsx +++ b/src/layouts/Base/Right.jsx @@ -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() { return { hasError: true }; } + componentDidCatch(error, errorInfo) { + console.log(error, errorInfo); + } + get isAdminPage() { return this.props.isAdminPage || false; } @@ -56,6 +68,12 @@ class Right extends Component { return hasTab || false; }; + updateErrorState(flag) { + this.setState({ + hasError: flag, + }); + } + renderBreadcrumb = (currentRoutes = []) => { if (!currentRoutes || currentRoutes.length === 0) { return null;