2
0
Эх сурвалжийг харах

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 жил өмнө
parent
commit
10a841dcd5

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

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