;
-
-const withRouteAnalytics = (
- WrappedComponent: React.ComponentType
-) => {
- function ComponentWithRouteAnalytics(props: WrappedProps
) {
- const routeAnalyticsContext = useContext(RouteAnalyticsContext);
- // TODO(any): HoC prop types not working w/ emotion https://github.com/emotion-js/emotion/issues/3261
- return ;
- }
- ComponentWithRouteAnalytics.displayName = `withRouteAnalytics(${getDisplayName(
- WrappedComponent
- )})`;
- return ComponentWithRouteAnalytics;
-};
-
-export default withRouteAnalytics;
-export type {WithRouteAnalyticsProps};
diff --git a/static/gsApp/hooks/spendVisibility/enhancedUsageStatsOrganization.tsx b/static/gsApp/hooks/spendVisibility/enhancedUsageStatsOrganization.tsx
index 1583be5a02ac91..1331708139c916 100644
--- a/static/gsApp/hooks/spendVisibility/enhancedUsageStatsOrganization.tsx
+++ b/static/gsApp/hooks/spendVisibility/enhancedUsageStatsOrganization.tsx
@@ -1,4 +1,4 @@
-import {Fragment, useEffect, useMemo} from 'react';
+import {Fragment, useMemo} from 'react';
import styled from '@emotion/styled';
import {getSeriesApiInterval} from 'sentry/components/charts/utils';
@@ -10,8 +10,7 @@ import type {DataCategoryInfo} from 'sentry/types/core';
import type {Project} from 'sentry/types/project';
import {defined} from 'sentry/utils';
import {useApiQuery} from 'sentry/utils/queryClient';
-import type {WithRouteAnalyticsProps} from 'sentry/utils/routeAnalytics/withRouteAnalytics';
-import withRouteAnalytics from 'sentry/utils/routeAnalytics/withRouteAnalytics';
+import useRouteAnalyticsParams from 'sentry/utils/routeAnalytics/useRouteAnalyticsParams';
import {useNavigate} from 'sentry/utils/useNavigate';
import withProjects from 'sentry/utils/withProjects';
import type {UsageSeries} from 'sentry/views/organizationStats/types';
@@ -204,9 +203,7 @@ function getSpikeDetails({
return actualSpikes;
}
-interface EnhancedUsageStatsOrganizationProps
- extends WithRouteAnalyticsProps,
- UsageStatsOrganizationProps {
+interface EnhancedUsageStatsOrganizationProps extends UsageStatsOrganizationProps {
isSingleProject: boolean;
projects: Project[];
subscription: Subscription;
@@ -229,7 +226,6 @@ function EnhancedUsageStatsOrganization({
dataCategory,
dataCategoryName,
dataCategoryApiName,
- setRouteAnalyticsParams,
isSingleProject,
spikeCursor,
clientDiscard,
@@ -305,20 +301,12 @@ function EnhancedUsageStatsOrganization({
{staleTime: Infinity, retry: false, enabled: spikeThresholdsQueryEnabled}
);
- useEffect(() => {
- setRouteAnalyticsParams({
- subscription,
- organization,
- is_project_stats: isSingleProject,
- has_spike_data: isSingleProject && hasAccurateSpikes,
- });
- }, [
- hasAccurateSpikes,
- isSingleProject,
- organization,
- setRouteAnalyticsParams,
+ useRouteAnalyticsParams({
subscription,
- ]);
+ organization,
+ is_project_stats: isSingleProject,
+ has_spike_data: isSingleProject && hasAccurateSpikes,
+ });
const newEndpointQuery = useMemo(() => {
const query = endpointQuery;
@@ -496,6 +484,4 @@ const DroppedFromSpikesStat = styled('div')`
font-size: ${p => p.theme.fontSize.md};
`;
-export default withRouteAnalytics(
- withProjects(withSubscription(EnhancedUsageStatsOrganization))
-);
+export default withProjects(withSubscription(EnhancedUsageStatsOrganization));