Skip to content

Commit 270809c

Browse files
committed
fix: Add optional chaining for allowedDeploymentTypes to prevent runtime errors
1 parent 0cd72da commit 270809c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CDStepperContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export const CDStepperContent = ({
169169
</div>
170170
{!window._env_.HIDE_GITOPS_OR_HELM_OPTION &&
171171
!selectedEnvironment?.isVirtualEnvironment &&
172-
selectedEnvironment?.allowedDeploymentTypes.length > 0 &&
172+
selectedEnvironment?.allowedDeploymentTypes?.length > 0 &&
173173
// Want to show this when gitops module is installed, does not matter if it is configured or not
174174
(!noGitOpsModuleInstalledAndConfigured || isGitOpsInstalledButNotConfigured) && (
175175
<div className="mt-16">

src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CreateCICDPipeline.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const CreateCICDPipeline = ({
102102

103103
const checkForGitOpsRepoNotConfigured = () => {
104104
const isHelmEnforced =
105-
selectedEnvironment.allowedDeploymentTypes.length === 1 &&
105+
selectedEnvironment?.allowedDeploymentTypes?.length === 1 &&
106106
selectedEnvironment.allowedDeploymentTypes[0] === DeploymentAppTypes.HELM
107107

108108
const gitOpsRepoNotConfiguredAndOptionsHidden =
@@ -121,7 +121,7 @@ export const CreateCICDPipeline = ({
121121
!window._env_.HIDE_GITOPS_OR_HELM_OPTION
122122

123123
const isGitOpsRepoNotConfiguredAndGitopsEnforced =
124-
isGitOpsRepoNotConfiguredAndOptionsVisible && selectedEnvironment.allowedDeploymentTypes.length === 1
124+
isGitOpsRepoNotConfiguredAndOptionsVisible && selectedEnvironment?.allowedDeploymentTypes?.length === 1
125125

126126
if (isGitOpsRepoNotConfiguredAndOptionsVisible) {
127127
setGitOpsRepoConfiguredWarning({ show: true, text: gitOpsRepoNotConfigured })

0 commit comments

Comments
 (0)