Skip to content

Commit e737cf4

Browse files
mtopo27claude
authored andcommitted
fix(notifications): Handle null provider in organization integrations filter (#112368)
Handle null provider in the organization integrations filter on the notification settings page. The `/users/me/organization-integrations/` API can return entries with a null `provider` field. The `ALLOWED_PROVIDERS` filter added in #111745 accesses `orgIntegration.provider.key` without null safety, crashing the page with `TypeError: Cannot read properties of null (reading 'provider')`. Adds optional chaining to match the pattern already used for the identity provider filter a few lines above. handles JAVASCRIPT-38j8 & JAVASCRIPT-38N4 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b11e3d3 commit e737cf4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

static/app/views/settings/account/notifications/notificationSettingsByType.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,13 @@ export function NotificationSettingsByType({notificationType}: Props) {
9898
);
9999

100100
const {data: allOrgIntegrations = [], status: organizationIntegrationStatus} =
101-
useApiQuery<OrganizationIntegration[]>(
101+
useApiQuery<Array<OrganizationIntegration | null>>(
102102
[getApiUrl('/users/$userId/organization-integrations/', {path: {userId: 'me'}})],
103103
{staleTime: 30_000}
104104
);
105-
const organizationIntegrations = allOrgIntegrations.filter(orgIntegration =>
106-
ALLOWED_PROVIDERS.has(orgIntegration.provider.key as SupportedProviders)
105+
const organizationIntegrations = allOrgIntegrations.filter(
106+
(orgIntegration): orgIntegration is OrganizationIntegration =>
107+
ALLOWED_PROVIDERS.has(orgIntegration?.provider.key as SupportedProviders)
107108
);
108109
const {data: defaultSettings, status: defaultSettingsStatus} =
109110
useApiQuery<DefaultSettings>([getApiUrl('/notification-defaults/')], {

0 commit comments

Comments
 (0)