Skip to content

Commit ba8828d

Browse files
committed
fix: handle potential null values in default configuration assignment
1 parent 319dfdf commit ba8828d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Pages/GlobalConfigurations/BuildInfra/UseBuildInfraForm.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ const useBuildInfraForm = ({
423423
infraConfigTypes?.forEach((infraConfigType) => {
424424
currentConfiguration[infraConfigType] = {
425425
...currentConfiguration[infraConfigType],
426-
...lastSavedConfiguration[infraConfigType].defaultValue,
426+
...lastSavedConfiguration[infraConfigType]?.defaultValue,
427427
active: false,
428428
} as BuildInfraConfigurationType
429429

@@ -505,8 +505,9 @@ const useBuildInfraForm = ({
505505
originalPlatformConfig,
506506
).reduce<BuildInfraConfigurationMapType>(
507507
(acc, [configKey, configValue]: [BuildInfraConfigTypes, BuildInfraConfigurationType]) => {
508-
const newDefaultValue = newPlatformFallbackConfig[configKey].defaultValue
509-
const newConfigValues = configValue.active ? {} : newDefaultValue
508+
// Would be null incase of not supported by buildX
509+
const newDefaultValue = newPlatformFallbackConfig[configKey]?.defaultValue
510+
const newConfigValues = configValue?.active ? {} : newDefaultValue
510511

511512
acc[configKey] = {
512513
...configValue,

0 commit comments

Comments
 (0)