@@ -313,6 +313,18 @@ const useBuildInfraForm = ({
313
313
}
314
314
} , [ profileResponse , isLoading ] )
315
315
316
+ const getReservedPlatformNameMap = ( currentInputConfigurations : Record < string , unknown > ) : Record < string , true > => {
317
+ const currentConfigPlatforms = Object . keys ( currentInputConfigurations || { } )
318
+ const originalConfigPlatforms = Object . keys ( profileResponse ?. profile ?. configurations || { } )
319
+
320
+ return currentConfigPlatforms
321
+ . concat ( originalConfigPlatforms )
322
+ . reduce < Record < string , true > > ( ( acc , platformName ) => {
323
+ acc [ platformName ] = true
324
+ return acc
325
+ } , { } )
326
+ }
327
+
316
328
// NOTE: Currently sending and receiving values as string, but will parse it to number for payload
317
329
const handleProfileInputChange = ( { action, data } : HandleProfileInputChangeType ) => {
318
330
const currentInput = structuredClone ( profileInput )
@@ -437,7 +449,10 @@ const useBuildInfraForm = ({
437
449
// If no target platform is given error will be '' so that we won;t show error but capture it
438
450
currentInputErrors [ BuildInfraProfileAdditionalErrorKeysType . TARGET_PLATFORM ] = ! targetPlatform
439
451
? ''
440
- : validateTargetPlatformName ( targetPlatform , currentInput . configurations ) . message
452
+ : validateTargetPlatformName (
453
+ targetPlatform ,
454
+ getReservedPlatformNameMap ( currentInput . configurations ) ,
455
+ ) . message
441
456
442
457
currentInput . configurations [ targetPlatform ] =
443
458
profileResponse . fallbackPlatformConfigurationMap [ targetPlatform ] ||
@@ -493,7 +508,10 @@ const useBuildInfraForm = ({
493
508
}
494
509
495
510
currentInputErrors [ BuildInfraProfileAdditionalErrorKeysType . TARGET_PLATFORM ] =
496
- validateTargetPlatformName ( newPlatformName , currentInput . configurations ) . message
511
+ validateTargetPlatformName (
512
+ newPlatformName ,
513
+ getReservedPlatformNameMap ( currentInput . configurations ) ,
514
+ ) . message
497
515
498
516
const newPlatformFallbackConfig =
499
517
profileResponse . fallbackPlatformConfigurationMap [ newPlatformName ] ||
0 commit comments