Skip to content

Commit

Permalink
Hot Fix and null check for Env Groups (#3572)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdess09 authored Sep 14, 2023
1 parent f358157 commit 8ffa3ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import Spacer from "components/porter/Spacer";
import EnvGroupArray from "main/home/cluster-dashboard/env-groups/EnvGroupArray";
import React, { useEffect, useState } from "react";
import styled, { keyframes } from "styled-components";
import Text from "components/porter/Text";
import Error from "components/porter/Error";
import sliders from "assets/sliders.svg";
import EnvGroupModal from "./env-vars/EnvGroupModal";
import { PopulatedEnvGroup } from "../../../../components/porter-form/types";
import { PopulatedEnvGroup } from "components/porter-form/types";
import _, { isObject, differenceBy, omit } from "lodash";


Expand Down Expand Up @@ -38,15 +34,15 @@ const ExpandableEnvGroup: React.FC<{
</Flex>
{isExpanded && (
<>
{isObject(envGroup.variables) ? (
{isObject(envGroup.variables) || isObject(envGroup.secret_variables) ? (
<>
{[
...Object.entries(envGroup?.variables || {}).map(([key, value]) => ({
key,
value,
source: 'variables',
})),
...Object.entries(envGroup.secret_variables || {}).map(([key, value]) => ({
...Object.entries(envGroup?.secret_variables || {}).map(([key, value]) => ({
key,
value,
source: 'secret_variables',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ const EnvGroupArray = ({
}
}, [values]);
const isKeyOverriding = (key: string) => {
if (!syncedEnvGroups) return false;
return syncedEnvGroups.some(envGroup =>
key in envGroup.variables || key in envGroup?.secret_variables
if (!syncedEnvGroups || !values) return false;
return syncedEnvGroups?.some(envGroup =>
(envGroup?.variables) && key in envGroup?.variables || key in envGroup?.secret_variables
);
};

Expand Down

0 comments on commit 8ffa3ea

Please sign in to comment.