Skip to content

Commit

Permalink
fix: add catch blocks to fetch calls
Browse files Browse the repository at this point in the history
Changes in appDetails/AppDetails.tsx, details/main.tsx &
appDetails/AppDetails.component.tsx
  • Loading branch information
Elessar1802 committed Feb 23, 2024
1 parent 8d78097 commit 831179f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/components/app/details/appDetails/AppDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ export const Details: React.FC<DetailsType> = ({
}
},
)
.catch(noop)
.catch((error) => {
showError(error)
})
},
[
params.appId,
Expand Down
9 changes: 5 additions & 4 deletions src/components/app/details/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
ToastBody,
DeleteDialog,
ErrorScreenManager,
noop,
} from '@devtron-labs/devtron-fe-common-lib'
import { MultiValue } from 'react-select'
import { toast } from 'react-toastify'
Expand Down Expand Up @@ -111,9 +110,9 @@ export default function AppDetailsPage({ isV2 }: AppDetailsProps) {
setGroupFilterOptions(_groupFilterOption)
}
} catch (error) {
noop;
showError(error)
}
setAppListLoading(true)
setAppListLoading(false)
}

const getAppListData = async (): Promise<void> => {
Expand All @@ -133,7 +132,9 @@ export default function AppDetailsPage({ isV2 }: AppDetailsProps) {
.sort(sortOptionsByLabel),
)
}
} catch (error) {noop}
} catch (error) {
showError(error)
}
setAppListLoading(false)
}

Expand Down
6 changes: 4 additions & 2 deletions src/components/v2/appDetails/AppDetails.component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useRef, useState } from 'react'
import './appDetails.scss'
import { useLocation, useParams } from 'react-router'
import { DeploymentAppTypes, Progressing, noop } from '@devtron-labs/devtron-fe-common-lib'
import { DeploymentAppTypes, Progressing, showError } from '@devtron-labs/devtron-fe-common-lib'
import { AppDetailsComponentType, AppStreamData, AppType } from './appDetails.type'
import IndexStore from './index.store'
import EnvironmentStatusComponent from './sourceInfo/environmentStatus/EnvironmentStatus.component'
Expand Down Expand Up @@ -106,7 +106,9 @@ const AppDetailsComponent = ({
}
},
)
.catch(noop)
.catch((error) => {
showError(error)
})
}

const processDeploymentStatusData = (deploymentStatusDetailRes: DeploymentStatusDetailsType): void => {
Expand Down

0 comments on commit 831179f

Please sign in to comment.