Skip to content

ref: Convert from useRoutes() to useMatches() in areas related to getRouteStringFromRoutes()#112265

Merged
ryan953 merged 10 commits into
masterfrom
ryan953/ref-getRouteStringFromRoutes
Apr 7, 2026
Merged

ref: Convert from useRoutes() to useMatches() in areas related to getRouteStringFromRoutes()#112265
ryan953 merged 10 commits into
masterfrom
ryan953/ref-getRouteStringFromRoutes

Conversation

@ryan953
Copy link
Copy Markdown
Member

@ryan953 ryan953 commented Apr 6, 2026

This removes almost all the useRoutes() calls related to getRouteStringFromRoutes().

There's still a few more related to breadcrumbs, and a class-based <DateRange> component :(

All the changes were very mechanical:

  • We're swapping routes for matches most of the time.
  • getRouteStringFromRoutes has a new parallel impl for matches, test was updated to match and i validated it in-app too
  • useRouteActivatedHook() accepts more props than it uses. I even added a new prop to the list, because react was complaining that the hook was not being called from within a Context parent. I guess our hooks system loses React Context links between the top of the tree and lower down. The specific type is vendored, so i left it alone.

Related to https://github.com/getsentry/frontend-tsc/issues/78

@ryan953 ryan953 requested review from a team as code owners April 6, 2026 16:39
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 6, 2026
@ryan953 ryan953 changed the title Ryan953/ref get route string from routes ref: Convert from useRoutes() to useMatches() in areas related to getRouteStringFromRoutes() Apr 6, 2026
@ryan953 ryan953 merged commit 659bef9 into master Apr 7, 2026
79 of 81 checks passed
@ryan953 ryan953 deleted the ryan953/ref-getRouteStringFromRoutes branch April 7, 2026 20:43
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
…RouteStringFromRoutes() (#112265)

This removes almost all the `useRoutes()` calls related to
`getRouteStringFromRoutes()`.

There's still a few more related to breadcrumbs, and a class-based
`<DateRange>` component :(

All the changes were very mechanical:
- We're swapping `routes` for `matches` most of the time. 
- `getRouteStringFromRoutes` has a new parallel impl for `matches`, test
was updated to match and i validated it in-app too
- `useRouteActivatedHook()` accepts more props than it uses. I even
added a new prop to the list, because react was complaining that the
hook was not being called from within a Context parent. I guess our
hooks system loses React Context links between the top of the tree and
lower down. The specific type is
[vendored](https://github.com/getsentry/sentry/blob/master/static/app/types/legacyReactRouter.tsx#L72-L78),
so i left it alone.


Related to getsentry/frontend-tsc#78
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants