Skip to content

feat(react-router): Switch to new stable instrumentations api#1265

Merged
chargome merged 2 commits into
masterfrom
cg-rr-stable-instrumentations-api
May 12, 2026
Merged

feat(react-router): Switch to new stable instrumentations api#1265
chargome merged 2 commits into
masterfrom
cg-rr-stable-instrumentations-api

Conversation

@chargome
Copy link
Copy Markdown
Member

@chargome chargome commented May 6, 2026

The api became stable in https://reactrouter.com/changelog#v7150, so we just bump the version guard and use the stable variant.

ref getsentry/sentry-javascript#20690

@chargome chargome self-assigned this May 6, 2026
@chargome chargome requested a review from nicohrubec May 6, 2026 09:18
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f26141b. Configure here.

id &&
id.type === 'Identifier' &&
(id.name === 'instrumentations' ||
id.name === 'unstable_instrumentations')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Legacy export blocks migration

Medium Severity

The instrumentInstrumentations function incorrectly treats the legacy unstable_instrumentations export as the new instrumentations export. This prevents the codemod from adding the correct instrumentations export when rerun, disabling server-side loader/action instrumentation for React Router >=7.15.0 apps.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f26141b. Configure here.

return addPropToHydratedRouter(
ast,
'unstable_instrumentations',
'instrumentations',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Client legacy prop remains stale

Medium Severity

addInstrumentationPropsToHydratedRouter only adds the stable instrumentations prop and never migrates existing unstable_instrumentations. Existing Sentry-instrumented apps keep the legacy prop after rerunning the wizard, so React Router >=7.15.0 will miss client-side instrumentation.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f26141b. Configure here.

@chargome chargome merged commit f7b6c45 into master May 12, 2026
103 of 106 checks passed
@chargome chargome deleted the cg-rr-stable-instrumentations-api branch May 12, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants