Skip to content

Commit ba94e0f

Browse files
committed
chore: handling of error & reload in selector
1 parent 06b93b5 commit ba94e0f

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

src/components/AppSelector/AppSelector.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const AppSelector = ({ onChange, appId, appName, isJobView }: AppSelectorType) =
4949

5050
const shouldFetchAppOptions = !!recentlyVisitedResources.length
5151

52-
const [loading, selectOptions] = useAsync(
52+
const [loading, selectOptions, error, reload] = useAsync(
5353
() =>
5454
appListOptions({
5555
inputValue,
@@ -91,6 +91,8 @@ const AppSelector = ({ onChange, appId, appName, isJobView }: AppSelectorType) =
9191
onChange={handleChange}
9292
value={{ value: appId, label: appName }}
9393
placeholder={appName}
94+
optionListError={error}
95+
reloadOptionList={reload}
9496
/>
9597
)
9698
}

src/components/AppSelector/ChartSelector.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export default function ChartSelector({
8686
placeholder={selectedChartLabel}
8787
{...(formatOptionLabel ? { formatOptionLabel } : {})}
8888
{...(filterOption ? { filterOption } : {})}
89+
optionListError={error}
90+
reloadOptionList={reload}
8991
/>
9092
)
9193
}

src/components/ApplicationGroup/EnvSelector.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const EnvSelector = ({ onChange, envId, envName }: EnvSelectorType) => {
4545
},
4646
})
4747

48-
const [loading, selectOptions] = useAsync(
48+
const [loading, selectOptions, error, reload] = useAsync(
4949
() => envListOptions(inputValue, abortControllerRef.current.signal, recentlyVisitedResources),
5050
[inputValue, recentlyVisitedResources],
5151
isEnvDataAvailable && !!recentlyVisitedResources.length,
@@ -77,6 +77,8 @@ export const EnvSelector = ({ onChange, envId, envName }: EnvSelectorType) => {
7777
placeholder={envName}
7878
inputValue={inputValue}
7979
onInputChange={onInputChange}
80+
optionListError={error}
81+
reloadOptionList={reload}
8082
/>
8183
)
8284
}

src/components/app/details/appDetails/AppDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ const Details: React.FC<DetailsType> = ({
578578
) {
579579
return (
580580
<>
581-
{primaryResourceList.length && (
581+
{!!primaryResourceList.length && (
582582
<div className="flex left ml-20 mt-16">
583583
<AppEnvSelector
584584
{...(isAppView ? { isAppView, environments } : { isAppView: false, applications })}

0 commit comments

Comments
 (0)