Skip to content

Commit 825a786

Browse files
cursoragentarmenzg
andcommitted
fix(aci): Restore project-not-found guard in edit.tsx
The !project guard was removed from edit.tsx causing useDetectorFormProject() to throw when a detector's project is missing or inaccessible. This error propagates uncaught since the ErrorBoundary in FormSection is too low in the component tree to catch errors from parent components like AutomateSection and *IssuePreview components that call useDetectorFormProject() in their body. Re-adding the guard ensures a friendly 'Project not found' error is shown instead of crashing the entire page. Co-authored-by: Armen Zambrano G. <armenzg@users.noreply.github.com>
1 parent 15d15c8 commit 825a786

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

static/app/views/detectors/edit.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {useDetectorQuery} from 'sentry/views/detectors/hooks';
1010

1111
export default function DetectorEdit() {
1212
const params = useParams<{detectorId: string}>();
13-
const {fetching: isFetchingProjects} = useProjects();
13+
const {projects, fetching: isFetchingProjects} = useProjects();
1414
useWorkflowEngineFeatureGate({redirect: true});
1515

1616
const {
@@ -34,6 +34,11 @@ export default function DetectorEdit() {
3434
);
3535
}
3636

37+
const project = projects.find(p => p.id === detector.projectId);
38+
if (!project) {
39+
return <LoadingError message={t('Project not found')} />;
40+
}
41+
3742
return (
3843
<DetectorFormProvider detectorType={detector.type} detector={detector}>
3944
<EditExistingDetectorForm detector={detector} />

0 commit comments

Comments
 (0)