Skip to content

Commit

Permalink
more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ameliahsu committed Aug 7, 2024
1 parent 7258198 commit e4c6996
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import AddIntegrationRow from 'sentry/views/alerts/rules/issue/addIntegrationRow
import {IntegrationContext} from 'sentry/views/settings/organizationIntegrations/integrationContext';

type Props = ModalRenderProps & {
headerContent: string;
headerContent: React.ReactNode;
organization: Organization;
project: Project;
providerKeys: string[];
bodyContent?: string;
bodyContent?: React.ReactNode;
onAddIntegration?: () => void;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {useEffect} from 'react';
import styled from '@emotion/styled';

import {openModal} from 'sentry/actionCreators/modal';
Expand All @@ -10,6 +9,7 @@ import {space} from 'sentry/styles/space';
import type {Project} from 'sentry/types/project';
import {trackAnalytics} from 'sentry/utils/analytics';
import {useApiQuery} from 'sentry/utils/queryClient';
import useRouteAnalyticsParams from 'sentry/utils/routeAnalytics/useRouteAnalyticsParams';
import useOrganization from 'sentry/utils/useOrganization';
import MessagingIntegrationModal from 'sentry/views/alerts/rules/issue/messagingIntegrationModal';

Expand Down Expand Up @@ -44,20 +44,17 @@ function SetupMessagingIntegrationButton({projectSlug, refetchConfigs}: Props) {
{staleTime: Infinity}
);

useEffect(() => {
if (project && !project.hasAlertIntegrationInstalled) {
trackAnalytics('onboarding.messaging_integration_button_rendered', {
project_id: project.id,
organization,
});
}
}, [project, organization]);
const shouldRenderSetupButton = project && !project.hasAlertIntegrationInstalled;

useRouteAnalyticsParams({
setup_message_integration_button_shown: shouldRenderSetupButton,
});

if (isLoading || isError) {
return null;
}

if (!project || project.hasAlertIntegrationInstalled) {
if (!shouldRenderSetupButton) {
return null;
}

Expand Down

0 comments on commit e4c6996

Please sign in to comment.