Skip to content

ref: Mark legacy react-router shim hooks as deprecated#115767

Merged
ryan953 merged 4 commits into
masterfrom
ryan953/ref/deprecate-legacy-router-shims
May 19, 2026
Merged

ref: Mark legacy react-router shim hooks as deprecated#115767
ryan953 merged 4 commits into
masterfrom
ryan953/ref/deprecate-legacy-router-shims

Conversation

@ryan953
Copy link
Copy Markdown
Member

@ryan953 ryan953 commented May 18, 2026

Summary

  • Add @deprecated JSDoc annotations to browserHistory, useLocation, useNavigate, useRouter, and useRoutes
  • Include tracking issue link (https://github.com/getsentry/frontend-tsc/issues/78) in each deprecation notice
  • These shims bridge react-router 3 patterns to react-router 6 and should be replaced with direct react-router-dom imports or nuqs

Test plan

  • No behavior changes — deprecation annotations only
  • IDE strikethrough/warnings appear on usage of deprecated hooks

Add @deprecated JSDoc annotations and tracking issue links to
browserHistory, useLocation, useNavigate, useRouter, and useRoutes.
These shims bridge react-router 3 patterns to react-router 6 and
should be replaced with direct react-router-dom imports or nuqs.

Refs getsentry/frontend-tsc#78
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 18, 2026
@ryan953 ryan953 marked this pull request as ready for review May 18, 2026 23:13
@ryan953 ryan953 requested a review from a team as a code owner May 18, 2026 23:13
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.56%

Comment thread static/app/utils/useLocation.tsx Outdated

/**
*
* @deprecated Please do not use this. Use `import { useLocation } from 'react-router-dom'` instead.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cursoragent revert changes to this file

Copy link
Copy Markdown
Contributor

@cursor cursor Bot May 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've successfully reverted the changes to static/app/utils/useLocation.tsx as requested.

The deprecation notice that was added to the useLocation hook has been removed, and the file has been restored to its original state. The changes have been committed and pushed to the ryan953/ref/deprecate-legacy-router-shims branch.

Summary:

  • ✅ Removed @deprecated JSDoc annotation from useLocation
  • ✅ Committed with message: "Revert deprecation changes to useLocation"
  • ✅ Pushed to remote branch

The PR now only deprecates browserHistory, useNavigate, useRouter, and useRoutes, while leaving useLocation unchanged.

Open in Web Open in Cursor 

Co-authored-by: Ryan Albrecht <ryan@ryanalbrecht.ca>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cursoragent revert the changes to this file

Copy link
Copy Markdown
Contributor

@cursor cursor Bot May 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've successfully reverted the changes to static/app/utils/useNavigate.tsx as requested.

The deprecation notice that was added to the useNavigate hook has been removed, and the file has been restored to its original state. The changes have been committed and pushed to the ryan953/ref/deprecate-legacy-router-shims branch.

Summary:

  • ✅ Removed @deprecated JSDoc annotation from useNavigate
  • ✅ Committed with message: "Revert deprecation changes to useNavigate"
  • ✅ Pushed to remote branch

The PR now only deprecates browserHistory, useRouter, and useRoutes, while useLocation and useNavigate remain unchanged.

Open in Web Open in Cursor 

Co-authored-by: Ryan Albrecht <ryan@ryanalbrecht.ca>
Comment thread static/app/utils/useRoutes.tsx Outdated
@ryan953 ryan953 merged commit 202a793 into master May 19, 2026
71 checks passed
@ryan953 ryan953 deleted the ryan953/ref/deprecate-legacy-router-shims branch May 19, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants