@@ -296,7 +296,6 @@ export const Details: React.FC<DetailsType> = ({
296
296
const appDetailsAbortRef = useRef ( null )
297
297
const shouldFetchTimelineRef = useRef ( false )
298
298
299
-
300
299
const [ deploymentStatusDetailsBreakdownData , setDeploymentStatusDetailsBreakdownData ] =
301
300
useState < DeploymentStatusDetailsBreakdownDataType > ( {
302
301
...( isVirtualEnvRef . current && processVirtualEnvironmentDeploymentData
@@ -408,7 +407,7 @@ export const Details: React.FC<DetailsType> = ({
408
407
409
408
async function callAppDetailsAPI ( fetchExternalLinks ?: boolean ) {
410
409
appDetailsAPI ( params . appId , params . envId , interval - 5000 , appDetailsAbortRef . current . signal )
411
- . then ( ( response ) => {
410
+ . then ( async ( response ) => {
412
411
isVirtualEnvRef . current = response . result ?. isVirtualEnvironment
413
412
// This means the CD is not triggered and the app is not helm migrated i.e. Empty State
414
413
if (
@@ -428,25 +427,31 @@ export const Details: React.FC<DetailsType> = ({
428
427
IndexStore . publishAppDetails ( appDetailsRef . current , AppType . DEVTRON_APP )
429
428
setAppDetails ( appDetailsRef . current )
430
429
431
- const isIsolatedEnv = isVirtualEnvRef . current && ! ! appDetailsRef . current . resourceTree
432
-
433
- _getDeploymentStatusDetail ( appDetailsRef . current . deploymentAppType , isIsolatedEnv , isIsolatedEnv ? appDetailsRef . current ?. resourceTree ?. wfrId : null )
434
-
435
430
if ( fetchExternalLinks && response . result ?. clusterId ) {
436
431
getExternalLinksAndTools ( response . result . clusterId )
437
432
}
438
433
pollResourceTreeRef . current = true
434
+
435
+ if ( pollResourceTreeRef . current ) {
436
+ // Need to wait for the resource tree to check if the env is isolated or not
437
+ await fetchResourceTree ( )
438
+ }
439
+
440
+ const isIsolatedEnv = isVirtualEnvRef . current && ! ! appDetailsRef . current . resourceTree
441
+
442
+ _getDeploymentStatusDetail (
443
+ appDetailsRef . current . deploymentAppType ,
444
+ isIsolatedEnv ,
445
+ isIsolatedEnv ? appDetailsRef . current ?. resourceTree ?. wfrId : null ,
446
+ )
439
447
} )
440
448
. catch ( handleAppDetailsCallError )
441
449
. finally ( ( ) => {
442
450
setLoadingDetails ( false )
443
451
} )
444
- if ( pollResourceTreeRef . current ) {
445
- fetchResourceTree ( )
446
- }
447
452
}
448
453
449
- const fetchResourceTree = ( ) => {
454
+ const fetchResourceTree = ( ) =>
450
455
fetchResourceTreeInTime ( params . appId , params . envId , interval - 5000 , appDetailsAbortRef . current . signal )
451
456
. then ( ( response ) => {
452
457
if (
@@ -473,9 +478,12 @@ export const Details: React.FC<DetailsType> = ({
473
478
. finally ( ( ) => {
474
479
setLoadingResourceTree ( false )
475
480
} )
476
- }
477
481
478
- function _getDeploymentStatusDetail ( deploymentAppType : DeploymentAppTypes , isIsolatedEnv : boolean , triggerIdToFetch ?: number ) {
482
+ function _getDeploymentStatusDetail (
483
+ deploymentAppType : DeploymentAppTypes ,
484
+ isIsolatedEnv : boolean ,
485
+ triggerIdToFetch ?: number ,
486
+ ) {
479
487
const shouldFetchTimeline = shouldFetchTimelineRef . current
480
488
481
489
// triggerIdToFetch represents the wfrId to fetch for any specific deployment
@@ -944,7 +952,7 @@ export const EnvSelector = ({
944
952
</ div >
945
953
< div data-testid = "app-deployed-env-name" className = "app-details__selector w-200" >
946
954
< SelectPicker
947
- inputId = ' app-environment-select'
955
+ inputId = " app-environment-select"
948
956
placeholder = "Select Environment"
949
957
options = { groupList }
950
958
value = { envId ? { value : + envId , label : environmentName } : null }
0 commit comments