Просмотр исходного кода

Avoid showing error modal if error is falsy

jnfrati 4 лет назад
Родитель
Сommit
644e9d6e72
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      dashboard/src/main/CurrentError.tsx

+ 5 - 0
dashboard/src/main/CurrentError.tsx

@@ -26,12 +26,17 @@ export default class CurrentError extends Component<PropsType, StateType> {
   }
 
   render() {
+    if (!this.props.currentError) {
+      return null;
+    }
+
     // Check if it's an error from the API then retrieve the error message that we get from the API
     let currentError =
       this.props.currentError?.response?.data?.error || this.props.currentError;
     if (!React.isValidElement(currentError)) {
       currentError = String(currentError);
     }
+
     if (currentError) {
       if (!this.state.expanded) {
         return (