Bläddra i källkod

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 år sedan
förälder
incheckning
10a841dcd5
1 ändrade filer med 9 tillägg och 1 borttagningar
  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])