Skip to content

Commit 200c06c

Browse files
authored
fix(settings): Defensively check existence of project in case of project deletion (#102969)
- Fixes [JAVASCRIPT-34DZ](https://sentry.sentry.io/issues/7004308572?project=11276) - Fixes [JAVASCRIPT-34E0](https://sentry.sentry.io/issues/7004321017?project=11276) - Fixes [JAVASCRIPT-34E6](https://sentry.sentry.io/issues/7004778464?project=11276) Defensively checking the existence of `project` to protect against project deletion and a subsequent re-render.
1 parent fa7d37d commit 200c06c

File tree

1 file changed

+6
-1
lines changed
  • static/app/views/settings/projectGeneralSettings

1 file changed

+6
-1
lines changed

static/app/views/settings/projectGeneralSettings/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import JsonForm from 'sentry/components/forms/jsonForm';
1919
import type {FieldValue} from 'sentry/components/forms/model';
2020
import type {FieldObject} from 'sentry/components/forms/types';
2121
import Hook from 'sentry/components/hook';
22+
import LoadingError from 'sentry/components/loadingError';
2223
import {removePageFiltersStorage} from 'sentry/components/organizations/pageFilters/persistence';
2324
import Panel from 'sentry/components/panels/panel';
2425
import PanelAlert from 'sentry/components/panels/panelAlert';
@@ -269,7 +270,7 @@ export function ProjectGeneralSettings({project, onChangeSlug}: Props) {
269270
disabled: !hasEveryAccess(['project:write'], {organization, project}),
270271
};
271272

272-
const team = project.teams.length ? project.teams?.[0] : undefined;
273+
const team = project.teams?.[0];
273274

274275
// XXX: HACK
275276
//
@@ -442,5 +443,9 @@ export default function ProjectGeneralSettingsContainer() {
442443
[navigate, organization.slug, routes, location]
443444
);
444445

446+
if (!project?.id) {
447+
return <LoadingError message={t('Failed to load project.')} />;
448+
}
449+
445450
return <ProjectGeneralSettings project={project} onChangeSlug={handleChangeSlug} />;
446451
}

0 commit comments

Comments
 (0)