From a7dc05dfed42451415fe6f2193162d2060c466f7 Mon Sep 17 00:00:00 2001 From: Evan Purkhiser Date: Mon, 26 Aug 2024 08:59:38 -0400 Subject: [PATCH] ref(js): Remove legacy withRouter types (#76484) These are not used anymore as the withSentryRouter is implemented using hooks. --- static/app/types/react-router.d.ts | 15 --------------- static/app/utils/withSentryRouter.tsx | 8 ++++---- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/static/app/types/react-router.d.ts b/static/app/types/react-router.d.ts index c46963c8d7742..e7079818ced70 100644 --- a/static/app/types/react-router.d.ts +++ b/static/app/types/react-router.d.ts @@ -32,19 +32,4 @@ declare module 'react-router' { router: InjectedRouter; routes: PlainRoute[]; } - - type ComponentConstructor

= - | ComponentClass

- | FunctionComponent

- | ComponentType

; - - declare function withRouter

( - component: ComponentConstructor

, - options?: Options - ): ComponentClass>; - - declare function withRouter

( - component: ComponentConstructor

& S, - options?: Options - ): ComponentClass> & S; } diff --git a/static/app/utils/withSentryRouter.tsx b/static/app/utils/withSentryRouter.tsx index ab4e2d468c40c..3116097808c4d 100644 --- a/static/app/utils/withSentryRouter.tsx +++ b/static/app/utils/withSentryRouter.tsx @@ -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

( WrappedComponent: React.ComponentType