Skip to content

Commit 5f7943e

Browse files
authored
feat(tanstackstart-react): Add component tracking (#17875)
Adds `reactComponentAnnotation` docs to the `sentryTanstackStart` Vite plugin page. Enabled in the SDK via getsentry/sentry-javascript#21149. This should be merged after the next SDK release (`10.55.0`). Also changed the structure to have a separate section for each TSS specific option and put them all one level below the `Configuration Options` section.
1 parent 2f399e0 commit 5f7943e

1 file changed

Lines changed: 36 additions & 5 deletions

File tree

docs/platforms/javascript/guides/tanstackstart-react/features/sentryTanstackStart.mdx

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ export default defineConfig({
5353

5454
The plugin passes through all options to the underlying [`@sentry/vite-plugin`](/platforms/javascript/sourcemaps/uploading/vite/). See the [Sentry Vite Plugin documentation](/platforms/javascript/sourcemaps/uploading/vite/) for the full list of available options.
5555

56-
Additionally, the plugin automatically instruments all TanStack Start middlewares for tracing by default. To disable this behavior:
56+
### Automatic Middleware Instrumentation
57+
58+
<AvailableSince version="10.37.0" />
59+
60+
The plugin automatically instruments all TanStack Start middlewares for tracing by default. To disable this behavior:
5761

5862
```typescript {filename:vite.config.ts}
5963
sentryTanstackStart({
@@ -62,15 +66,42 @@ sentryTanstackStart({
6266
}),
6367
```
6468

65-
## Tunnel Route
69+
### Component Name Annotation
70+
71+
<AvailableSince version="10.55.0" />
72+
73+
The `reactComponentAnnotation` option annotates your React components with `data-sentry-component` and `data-sentry-source-file` attributes at build time. This lets you see component names instead of generic selectors in Session Replay, breadcrumbs, and performance monitoring.
74+
75+
```typescript {filename:vite.config.ts}
76+
sentryTanstackStart({
77+
// ...
78+
reactComponentAnnotation: {
79+
enabled: true,
80+
},
81+
}),
82+
```
83+
84+
To exclude specific components from annotation:
85+
86+
```typescript {filename:vite.config.ts}
87+
sentryTanstackStart({
88+
// ...
89+
reactComponentAnnotation: {
90+
enabled: true,
91+
ignoredComponents: ["MyInternalComponent"],
92+
},
93+
}),
94+
```
95+
96+
### Tunnel Route
6697

6798
<AvailableSince version="10.51.0" />
6899

69100
The `tunnelRoute` option registers a same-origin TanStack Start server route that forwards Sentry envelopes to Sentry's ingest servers. It also automatically sets the client `tunnel` option in `Sentry.init()` so browser events go through that route. This helps avoid ad blockers and corporate firewalls that block requests to `*.sentry.io`.
70101

71102
`tunnelRoute` accepts three shapes:
72103

73-
### `tunnelRoute: true` (recommended)
104+
#### `tunnelRoute: true` (recommended)
74105

75106
Generates an opaque, unguessable route path for each dev session and production build. Because the path changes between builds, ad blockers can't reliably target it.
76107

@@ -80,7 +111,7 @@ sentryTanstackStart({
80111
}),
81112
```
82113

83-
### Static path
114+
#### Static path
84115

85116
Pass a string to use a fixed route path. This is easier to reason about, but a known path is easier for ad blockers to add to a list.
86117

@@ -90,7 +121,7 @@ sentryTanstackStart({
90121
}),
91122
```
92123

93-
### Object form
124+
#### Object form
94125

95126
Use the object form to control the DSN allowlist or set a static path explicitly:
96127

0 commit comments

Comments
 (0)