Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix the types instead:

- useApiQuery<OrganizationIntegration[]>(
+ useApiQuery<Array<OrganizationIntegration | null>>(

in that case, TypeScript will force us to add the optional chaining. Also, it’s doubtful that if we get an integration, it has no key, so we’d only need:

ALLOWED_PROVIDERS.has(orgIntegration?.provider.key as SupportedProviders)

Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ export function NotificationSettingsByType({notificationType}: Props) {
);

const {data: allOrgIntegrations = [], status: organizationIntegrationStatus} =
useApiQuery<OrganizationIntegration[]>(
useApiQuery<Array<OrganizationIntegration | null>>(
[getApiUrl('/users/$userId/organization-integrations/', {path: {userId: 'me'}})],
{staleTime: 30_000}
);
const organizationIntegrations = allOrgIntegrations.filter(orgIntegration =>
ALLOWED_PROVIDERS.has(orgIntegration.provider.key as SupportedProviders)
const organizationIntegrations = allOrgIntegrations.filter(
(orgIntegration): orgIntegration is OrganizationIntegration =>
ALLOWED_PROVIDERS.has(orgIntegration?.provider.key as SupportedProviders)
);
const {data: defaultSettings, status: defaultSettingsStatus} =
useApiQuery<DefaultSettings>([getApiUrl('/notification-defaults/')], {
Expand Down
Loading