Skip to content

Commit 424693e

Browse files
authored
fix(aci): fix error state for nonexistent monitor details (#102929)
`!project` check was causing an infinite loading spinner on the monitor details page for nonexistent monitors also improved the error message for automation details page when the resource does not exist
1 parent 9898dcb commit 424693e

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

static/app/views/automations/detail.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ function AutomationDetailLoadingStates({automationId}: {automationId: string}) {
175175
data: automation,
176176
isPending,
177177
isError,
178+
error,
178179
refetch,
179180
} = useAutomationQuery(automationId);
180181

@@ -183,7 +184,12 @@ function AutomationDetailLoadingStates({automationId}: {automationId: string}) {
183184
}
184185

185186
if (isError) {
186-
return <LoadingError onRetry={refetch} />;
187+
return (
188+
<LoadingError
189+
message={error.status === 404 ? t('The alert could not be found.') : undefined}
190+
onRetry={refetch}
191+
/>
192+
);
187193
}
188194

189195
return <AutomationDetailContent automation={automation} />;

static/app/views/detectors/detail.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ import {useDetectorQuery} from 'sentry/views/detectors/hooks';
1414
function DetectorDetailsLoadingStates({
1515
detectorId,
1616
project,
17+
isFetchingProjects,
1718
}: {
1819
detectorId: string;
20+
isFetchingProjects: boolean;
1921
project: Project | undefined;
2022
}) {
2123
const {
@@ -26,7 +28,7 @@ function DetectorDetailsLoadingStates({
2628
refetch,
2729
} = useDetectorQuery(detectorId);
2830

29-
if (isPending || !project) {
31+
if (isPending || isFetchingProjects) {
3032
return <LoadingIndicator />;
3133
}
3234

@@ -67,7 +69,11 @@ export default function DetectorDetails() {
6769
id="DetectorDetails-Body"
6870
isLoading={isLoading}
6971
>
70-
<DetectorDetailsLoadingStates detectorId={params.detectorId} project={project} />
72+
<DetectorDetailsLoadingStates
73+
detectorId={params.detectorId}
74+
project={project}
75+
isFetchingProjects={isFetchingProjects}
76+
/>
7177
</VisuallyCompleteWithData>
7278
);
7379
}

0 commit comments

Comments
 (0)