Skip to content

Update @sentry/react from v7 to v10#121

Merged
TomWoodward merged 4 commits into
mainfrom
core-update-sentry-v10
Jun 24, 2026
Merged

Update @sentry/react from v7 to v10#121
TomWoodward merged 4 commits into
mainfrom
core-update-sentry-v10

Conversation

@TomWoodward

Copy link
Copy Markdown
Member

Summary

Updates the Sentry SDK to the most recent version: @sentry/react ^7.120.3^10.60.0, along with the toolchain the new major requires.

Dependency bumps

  • @sentry/react: ^7.120.3^10.60.0
  • sentry-testkit: ^5.0.5^6.4.1 (v8+ compatible)
  • typescript: ^4.7.4^5.9.3 — Sentry v9+ requires TS ≥ 5.0.4. Stayed on the latest 5.x rather than TS 6, which ts-jest@28 doesn't support.

Source changes (SDK breaking changes)

  • ErrorBoundary.tsxErrorBoundaryProps now imported from the package root; the internal @sentry/react/types/errorboundary deep path was removed in v8. v10 retypes the onError/fallback error as unknown, so added narrow as Error casts at the boundary (the runtime value from a React error boundary is always an Error).
  • ErrorBoundary.stories.tsxprops.error.toString()String(props.error) for the now-unknown type.

Test changes (environment/SDK behavior — not product bugs)

  • v8+ exposes its exports as read-only getters, breaking jest.spyOn. Mocked @sentry/react in the affected specs (spread + __esModule: true) so spies and the testkit transport keep working with the real implementations.
  • Added src/test/setup.ts (wired via setupFilesAfterEnv) polyfilling performance.getEntriesByType — v10's default browserTracingIntegration runs web-vitals instrumentation on init, which jsdom doesn't implement.
  • Added testkit.reset() to the ErrorBoundary spec's afterEach — v10 flushes captured events synchronously, which exposed cross-test report leakage.

Verification

  • yarn typecheck
  • yarn test ✅ (214/214)
  • yarn build
  • yarn lint ✅ (only a pre-existing "React version not specified" warning, unrelated)

Note for reviewers

The TypeScript 4.7 → 5.9 bump is lib-wide. Worth a sanity check that downstream consumers pinning against this lib's emitted types are comfortable with TS 5.x before release.

🤖 Generated with Claude Code

TomWoodward and others added 2 commits June 23, 2026 15:31
Bumps @sentry/react ^7.120.3 -> ^10.60.0 (most recent), plus the
supporting toolchain required by the new major:

- sentry-testkit ^5.0.5 -> ^6.4.1 (v8+ compatible)
- typescript ^4.7.4 -> ^5.9.3 (Sentry v9+ requires TS >= 5.0.4)

Source changes for SDK breaking changes:
- ErrorBoundary: import ErrorBoundaryProps from the package root (the
  internal @sentry/react/types/errorboundary path was removed in v8) and
  cast the now-`unknown` callback error to Error at the boundary.
- ErrorBoundary story: String(props.error) for the now-`unknown` type.

Test changes (environment/SDK behavior, not product bugs):
- v8+ exposes its exports as read-only getters, breaking jest.spyOn.
  Mock @sentry/react in the affected specs so spies and the testkit
  transport keep working.
- Add a jest setup file polyfilling performance.getEntriesByType, which
  v10's default browserTracingIntegration calls on init but jsdom lacks.
- Reset the testkit between ErrorBoundary tests; v10 flushes captured
  events synchronously, exposing cross-test report leakage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@RoyEJohnson RoyEJohnson left a comment

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.

Looks good to me. I note that Rex uses TypeScript 4.

@TomWoodward TomWoodward merged commit 585dc3d into main Jun 24, 2026
2 of 3 checks passed
@TomWoodward TomWoodward deleted the core-update-sentry-v10 branch June 24, 2026 19:58
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