瀏覽代碼

Check if previous values are empty on LoadEnvGroupModal.

When checking if there's overriden keys, the load env group modal fails if there's no previous keys, this changes add null safe checking for previous keys.
jnfrati 4 年之前
父節點
當前提交
10a841dcd5
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      dashboard/src/main/home/modals/LoadEnvGroupModal.tsx

+ 9 - 1
dashboard/src/main/home/modals/LoadEnvGroupModal.tsx

@@ -20,7 +20,7 @@ import {
 } from "components/porter-form/types";
 } from "components/porter-form/types";
 import Helper from "components/form-components/Helper";
 import Helper from "components/form-components/Helper";
 import DocsHelper from "components/DocsHelper";
 import DocsHelper from "components/DocsHelper";
-import { isObject } from "lodash";
+import { isEmpty, isObject } from "lodash";
 
 
 type PropsType = {
 type PropsType = {
   namespace: string;
   namespace: string;
@@ -161,6 +161,14 @@ export default class LoadEnvGroupModal extends Component<PropsType, StateType> {
     if (!incoming) {
     if (!incoming) {
       return [];
       return [];
     }
     }
+
+    if (
+      !isObject(this.props.existingValues) ||
+      isEmpty(this.props.existingValues)
+    ) {
+      return [];
+    }
+
     // console.log(incoming, this.props.existingValues);
     // console.log(incoming, this.props.existingValues);
     return Object.entries(incoming)
     return Object.entries(incoming)
       .filter(([key]) => this.props.existingValues[key])
       .filter(([key]) => this.props.existingValues[key])