@@ -236,6 +236,7 @@ const BulkDeployModal = ({ handleClose, stageType, workflows, isVirtualEnvironme
236
236
...prev ,
237
237
[ selectedAppId ] : {
238
238
...prev [ selectedAppId ] ,
239
+ materialResponse : response [ selectedAppId ] ?. materialResponse ,
239
240
warningMessage,
240
241
materialError,
241
242
deploymentWindowMetadata,
@@ -251,6 +252,10 @@ const BulkDeployModal = ({ handleClose, stageType, workflows, isVirtualEnvironme
251
252
} ) )
252
253
}
253
254
255
+ const reloadMaterials = async ( ) => {
256
+ await reloadOrSearchSelectedApp ( )
257
+ }
258
+
254
259
const handleLoadOlderImages = async ( ) => {
255
260
try {
256
261
// Even if user changes selectedAppId this will persist since a state closure
@@ -452,29 +457,31 @@ const BulkDeployModal = ({ handleClose, stageType, workflows, isVirtualEnvironme
452
457
const handleTagChange : DeployImageContentProps [ 'handleTagChange' ] = ( tagOption ) => {
453
458
setSelectedImageTagOption ( tagOption )
454
459
455
- const selectedApp = appInfoMap [ selectedAppId ]
456
- const updatedMaterials = getUpdatedMaterialsForTagSelection (
457
- tagOption . value ,
458
- selectedApp . materialResponse ?. materials || [ ] ,
459
- )
460
- const { tagsWarning, updatedMaterials : newMaterials } = updatedMaterials
460
+ setAppInfoMap ( ( prev ) => {
461
+ const updatedAppInfoMap = structuredClone ( prev )
462
+ Object . values ( updatedAppInfoMap ) . forEach ( ( appDetails ) => {
463
+ const { tagsWarning, updatedMaterials } = getUpdatedMaterialsForTagSelection (
464
+ tagOption . value ,
465
+ appDetails . materialResponse ?. materials || [ ] ,
466
+ )
461
467
462
- const { tagsWarning : previousTagWarning } = getUpdatedMaterialsForTagSelection (
463
- selectedImageTagOption . value ,
464
- selectedApp . materialResponse ?. materials || [ ] ,
465
- )
468
+ const { tagsWarning : previousTagWarning } = getUpdatedMaterialsForTagSelection (
469
+ selectedImageTagOption . value ,
470
+ appDetails . materialResponse ?. materials || [ ] ,
471
+ )
466
472
467
- setAppInfoMap ( ( prev ) => ( {
468
- ...prev ,
469
- [ selectedAppId ] : {
470
- ...prev [ selectedAppId ] ,
471
- materialResponse : {
472
- ...prev [ selectedAppId ] . materialResponse ,
473
- materials : newMaterials ,
474
- } ,
475
- warningMessage : previousTagWarning ? tagsWarning : prev [ selectedAppId ] . warningMessage ,
476
- } ,
477
- } ) )
473
+ updatedAppInfoMap [ appDetails . appId ] = {
474
+ ...appDetails ,
475
+ materialResponse : {
476
+ ...appDetails . materialResponse ,
477
+ materials : updatedMaterials ,
478
+ } ,
479
+ warningMessage :
480
+ previousTagWarning || ! appDetails . warningMessage ? tagsWarning : appDetails . warningMessage ,
481
+ }
482
+ } )
483
+ return updatedAppInfoMap
484
+ } )
478
485
}
479
486
480
487
const changeApp : DeployImageContentProps [ 'changeApp' ] = ( appId ) => {
@@ -601,7 +608,7 @@ const BulkDeployModal = ({ handleClose, stageType, workflows, isVirtualEnvironme
601
608
appName = { appName }
602
609
isSecurityModuleInstalled = { isSecurityModuleInstalled }
603
610
envName = { envName }
604
- reloadMaterials = { reloadOrSearchSelectedApp }
611
+ reloadMaterials = { reloadMaterials }
605
612
parentEnvironmentName = { parentEnvironmentName }
606
613
isVirtualEnvironment = { isVirtualEnvironment }
607
614
loadOlderImages = { handleLoadOlderImages }
0 commit comments