useDisableRouteAnalytics.tsx 476 B

1234567891011121314
  1. import {useContext, useEffect} from 'react';
  2. import {RouteAnalyticsContext} from 'sentry/views/routeAnalyticsContextProvider';
  3. /**
  4. * Disables route analytics when called in a component.
  5. * Must be called within 2s after the organization context is loaded.
  6. */
  7. export default function useDisableRouteAnalytics() {
  8. const {setDisableRouteAnalytics} = useContext(RouteAnalyticsContext);
  9. useEffect(() => {
  10. setDisableRouteAnalytics();
  11. }, [setDisableRouteAnalytics]);
  12. }