From b82d2fe18cf43d284146aecd8cf657fa48607589 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Fri, 27 Mar 2026 12:58:37 +0100 Subject: [PATCH] ref(routes): replace stats nav-v2 redirect with route-level redirects The navigation-sidebar-v2 feature flag is now fully launched, so the OrganizationStatsWrapper component and its useRedirectNavigationV2Routes hook are no longer needed. Replace with declarative redirectTo entries in the route definitions, pointing /stats/* to /settings/stats/*. Co-Authored-By: Claude Opus 4.6 --- static/app/router/routes.tsx | 16 ++++++++++++---- .../organizationStatsWrapper.tsx | 19 ------------------- 2 files changed, 12 insertions(+), 23 deletions(-) delete mode 100644 static/app/views/organizationStats/organizationStatsWrapper.tsx diff --git a/static/app/router/routes.tsx b/static/app/router/routes.tsx index 12278bd3bbc8c9..e014413354c016 100644 --- a/static/app/router/routes.tsx +++ b/static/app/router/routes.tsx @@ -36,7 +36,6 @@ import {OverviewWrapper} from 'sentry/views/issueList/overviewWrapper'; import {IssueTaxonomy} from 'sentry/views/issueList/taxonomies'; import {OrganizationContainerRoute} from 'sentry/views/organizationContainer'; import {OrganizationLayout} from 'sentry/views/organizationLayout'; -import {OrganizationStatsWrapper} from 'sentry/views/organizationStats/organizationStatsWrapper'; import {Tab as TransactionSummaryTab} from 'sentry/views/performance/transactionSummary/tabs'; import {ProjectEventRedirect} from 'sentry/views/projectEventRedirect'; import {redirectDeprecatedProjectRoute} from 'sentry/views/projects/redirectDeprecatedProjectRoute'; @@ -814,12 +813,21 @@ function buildRoutes(): RouteObject[] { { path: '/stats/', withOrgPath: true, - component: OrganizationStatsWrapper, - children: statsChildren, + redirectTo: '/settings/stats/', + }, + { + path: '/stats/issues/', + withOrgPath: true, + redirectTo: '/settings/stats/issues/', + }, + { + path: '/stats/health/', + withOrgPath: true, + redirectTo: '/settings/stats/health/', }, { path: '/organizations/:orgId/stats/team/', - redirectTo: '/organizations/:orgId/stats/issues/', + redirectTo: '/organizations/:orgId/settings/stats/issues/', }, ], }; diff --git a/static/app/views/organizationStats/organizationStatsWrapper.tsx b/static/app/views/organizationStats/organizationStatsWrapper.tsx deleted file mode 100644 index da70ff5b3c9bdc..00000000000000 --- a/static/app/views/organizationStats/organizationStatsWrapper.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import {Outlet} from 'react-router-dom'; - -import {Redirect} from 'sentry/components/redirect'; -import {useRedirectNavigationV2Routes} from 'sentry/views/navigation/useRedirectNavigationV2Routes'; - -// Wraps all routes under /stats/ to redirect to /settings/stats/ -// Can be removed once navigation-sidebar-v2 is fully launched -export function OrganizationStatsWrapper() { - const redirectPath = useRedirectNavigationV2Routes({ - oldPathPrefix: '/stats/', - newPathPrefix: `/settings/stats/`, - }); - - if (redirectPath) { - return ; - } - - return ; -}