Conversation
…route Refactor the MetricAlertDetails component to use React Router v6 hooks instead of receiving route props directly. This removes the need for deprecatedRouteProps on the route definition. Changes: - Add functional wrapper that uses useLocation, useOrganization, and useParams hooks - Remove RouteComponentProps from Props interface - Remove deprecatedRouteProps from route definition (line 1472) - Update all tests to use modern testing patterns with initialRouterConfig The class component is preserved as-is and wrapped with a functional component that provides the necessary props from hooks.
shashjar
approved these changes
Jan 15, 2026
trevor-e
pushed a commit
that referenced
this pull request
Jan 20, 2026
…route (#106348) ## Summary Removes `deprecatedRouteProps: true` from the `metricAlertRuleDetails` route by refactoring the component to use React Router v6 hooks. ## Changes - **Route file** (`static/app/router/routes.tsx`): - Removed `deprecatedRouteProps: true` from line 1472 - **Component** (`static/app/views/alerts/rules/metric/details/index.tsx`): - Added functional wrapper `MetricAlertDetailsWrapper` that uses `useLocation()`, `useOrganization()`, and `useParams()` hooks - Removed `RouteComponentProps` from Props interface - Class component remains unchanged and receives props from the wrapper - **Tests** (`static/app/views/alerts/rules/metric/details/index.spec.tsx`): - Updated all 7 tests to use `initialRouterConfig` with proper routing setup - Removed manual prop passing in favor of context-based routing - All tests passing ✅ ## Test Plan - ✅ All existing tests pass - ✅ Manual verification: navigated to alert rule details page - ✅ Verified routing works correctly with params extraction ## Related Work Part of the effort to remove all `deprecatedRouteProps` from the codebase and migrate to React Router v6 patterns. This is route 1 of 11 leaf routes that need updating.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes
deprecatedRouteProps: truefrom themetricAlertRuleDetailsroute by refactoring the component to use React Router v6 hooks.Changes
Route file (
static/app/router/routes.tsx):deprecatedRouteProps: truefrom line 1472Component (
static/app/views/alerts/rules/metric/details/index.tsx):MetricAlertDetailsWrapperthat usesuseLocation(),useOrganization(), anduseParams()hooksRouteComponentPropsfrom Props interfaceTests (
static/app/views/alerts/rules/metric/details/index.spec.tsx):initialRouterConfigwith proper routing setupTest Plan
Related Work
Part of the effort to remove all
deprecatedRoutePropsfrom the codebase and migrate to React Router v6 patterns. This is route 1 of 11 leaf routes that need updating.