Skip to content

test(tanstackstart-react): Move initialization to client entry point#21161

Merged
nicohrubec merged 4 commits into
developfrom
test/tanstack-start-early-init-reproductions
May 26, 2026
Merged

test(tanstackstart-react): Move initialization to client entry point#21161
nicohrubec merged 4 commits into
developfrom
test/tanstack-start-early-init-reproductions

Conversation

@nicohrubec
Copy link
Copy Markdown
Member

@nicohrubec nicohrubec commented May 26, 2026

Moves Sentry.init() from getRouter() to the client entry point so it runs before hydration in our e2e test applications. Previously, any errors or breadcrumbs from before hydration (e.g. third-party library inits) were silently lost because Sentry.init() only ran during hydration inside getRouter().

This should be the recommended setup for users, will update the docs accordingly.

Fixes #21088

@nicohrubec nicohrubec changed the title test(tanstackstart-react): Add failing E2E tests for early client init fix(tanstackstart-react): Move client-side Sentry.init() to client entry point May 26, 2026
@nicohrubec nicohrubec changed the title fix(tanstackstart-react): Move client-side Sentry.init() to client entry point fix(tanstackstart-react): Move Sentry.init() to client entry point May 26, 2026
@nicohrubec nicohrubec changed the title fix(tanstackstart-react): Move Sentry.init() to client entry point fix(tanstackstart-react): Move initialization to client entry point May 26, 2026
@nicohrubec nicohrubec changed the title fix(tanstackstart-react): Move initialization to client entry point test(tanstackstart-react): Move initialization to client entry point May 26, 2026
@nicohrubec nicohrubec marked this pull request as ready for review May 26, 2026 09:02
@nicohrubec nicohrubec requested review from chargome and s1gr1d May 26, 2026 09:04
Copy link
Copy Markdown
Member

@s1gr1d s1gr1d left a comment

Choose a reason for hiding this comment

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

Look good! It's probably worth to add something about that to the changelog.

nicohrubec and others added 3 commits May 26, 2026 15:59
Reproduces #21088: errors thrown in the client entry before hydration
are silently lost because Sentry.init() runs inside getRouter() which
is called during hydration. The test also verifies that early console
breadcrumbs are attached to the error report.

These tests are expected to fail with the current setup and pass once
Sentry.init() is moved to the client entry point.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Moves client-side Sentry.init() from getRouter() to client.tsx so it
runs before hydration. The browser tracing integration is added later
via addIntegration() once the router is available.

This ensures errors and breadcrumbs from code that runs before
hydration (e.g. third-party library inits) are captured.

Fixes #21088

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nicohrubec nicohrubec force-pushed the test/tanstack-start-early-init-reproductions branch from 8d712af to 13d0a45 Compare May 26, 2026 14:01
@nicohrubec nicohrubec force-pushed the test/tanstack-start-early-init-reproductions branch from 13d0a45 to e1f999b Compare May 26, 2026 14:03
Copy link
Copy Markdown

@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 1 potential issue.

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 e1f999b. Configure here.

@nicohrubec nicohrubec merged commit 556f99f into develop May 26, 2026
46 checks passed
@nicohrubec nicohrubec deleted the test/tanstack-start-early-init-reproductions branch May 26, 2026 14:20
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.

sentry client initialization should be in client entry point

2 participants