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

Merge pull request #1228 from porter-dev/por-62-frontend-crashes-on-repo-launch-to-non-default-namespace

[POR-62] Frontend crashes on repo launch to non-default namespace
jusrhee 4 лет назад
Родитель
Сommit
f9d16d4780
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      dashboard/src/main/CurrentError.tsx

+ 6 - 2
dashboard/src/main/CurrentError.tsx

@@ -26,11 +26,15 @@ export default class CurrentError extends Component<PropsType, StateType> {
   }
 
   render() {
+    let currentError = this.props.currentError;
+    if (!React.isValidElement(this.props.currentError)) {
+      currentError = String(this.props.currentError);
+    }
     if (this.props.currentError) {
       if (!this.state.expanded) {
         return (
           <StyledCurrentError>
-            <ErrorText>Error: {this.props.currentError}</ErrorText>
+            <ErrorText>Error: {currentError}</ErrorText>
             <ExpandButton onClick={() => this.setState({ expanded: true })}>
               <i className="material-icons">launch</i>
             </ExpandButton>
@@ -53,7 +57,7 @@ export default class CurrentError extends Component<PropsType, StateType> {
         <Overlay>
           <ExpandedError>
             Porter encountered an error. Full error log:
-            <CodeBlock>{this.props.currentError}</CodeBlock>
+            <CodeBlock>{currentError}</CodeBlock>
             <ExpandButtonAlt onClick={() => this.setState({ expanded: false })}>
               <i className="material-icons">remove</i>
             </ExpandButtonAlt>