Files
sentinel/static/app/utils/routeAnalytics/useRouteAnalyticsHookSetup.tsx
2024-02-15 17:01:50 +00:00

19 lines
548 B
TypeScript

import {useContext} from 'react';
import HookStore from 'sentry/stores/hookStore';
import {RouteAnalyticsContext} from 'sentry/views/routeAnalyticsContextProvider';
/**
* Sets the organization for route analytics events.
* Only needs to be used once for the entire app just
* below the Organization context.
*/
export default function useRouteAnalyticsHookSetup() {
const {setOrganization} = useContext(RouteAnalyticsContext);
HookStore.persistCallback(
'react-hook:route-activated',
'setOrganization',
setOrganization
);
}