Skip to content

Commit

Permalink
ref(js): Remove legacy withRouter types (#76484)
Browse files Browse the repository at this point in the history
These are not used anymore as the withSentryRouter is implemented using
hooks.
  • Loading branch information
evanpurkhiser committed Aug 26, 2024
1 parent 67c7897 commit a7dc05d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
15 changes: 0 additions & 15 deletions static/app/types/react-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,4 @@ declare module 'react-router' {
router: InjectedRouter<P, Q>;
routes: PlainRoute[];
}

type ComponentConstructor<P> =
| ComponentClass<P>
| FunctionComponent<P>
| ComponentType<P>;

declare function withRouter<P extends WithRouterProps>(
component: ComponentConstructor<P>,
options?: Options
): ComponentClass<Omit<P, keyof WithRouterProps>>;

declare function withRouter<P extends WithRouterProps, S>(
component: ComponentConstructor<P> & S,
options?: Options
): ComponentClass<Omit<P, keyof WithRouterProps>> & S;
}
8 changes: 4 additions & 4 deletions static/app/utils/withSentryRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import {CUSTOMER_DOMAIN, USING_CUSTOMER_DOMAIN} from 'sentry/constants';
import useRouter from './useRouter';

/**
* withSentryRouter is a higher-order component (HOC) that wraps withRouter, and implicitly injects the current customer
* domain as the orgId parameter. This only happens if a customer domain is currently being used.
* withSentryRouter is a higher-order component (HOC) that emulates withRouter,
* and implicitly injects the current customer domain as the orgId parameter.
* This only happens if a customer domain is currently being used.
*
* Since withRouter() is discouraged from being used on new React components, we would use withSentryRouter() on
* pre-existing React components.
* @deprecated only use in legacy react class components
*/
function withSentryRouter<P extends WithRouterProps>(
WrappedComponent: React.ComponentType<P>
Expand Down

0 comments on commit a7dc05d

Please sign in to comment.