Skip to content

Document lazyRouteManifest option for React Router v6 and v7#16397

Open
onurtemizkan wants to merge 2 commits intomasterfrom
onur/react-router-lazy-routes-manifest
Open

Document lazyRouteManifest option for React Router v6 and v7#16397
onurtemizkan wants to merge 2 commits intomasterfrom
onur/react-router-lazy-routes-manifest

Conversation

@onurtemizkan
Copy link
Collaborator

@vercel
Copy link

vercel bot commented Feb 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment Feb 16, 2026 6:12pm
sentry-docs Ready Ready Preview, Comment Feb 16, 2026 6:12pm

Request Review

Copy link
Collaborator

@inventarSarah inventarSarah left a comment

Choose a reason for hiding this comment

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

Overall, looks good to me 🌟
Added a few suggestions

To ensure accurate transaction names, you can provide a static list of route patterns via the `lazyRouteManifest` option. When provided, Sentry uses this manifest as the primary source for determining transaction names without needing to wait for route modules to load.

<Alert level="warning" title="Important">
`lazyRouteManifest` requires `enableAsyncRouteHandlers: true` to be set on the integration.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this alert is needed because we clearly state the dependency below + it's in the code example

});
```

Add the `enableAsyncRouteHandlers` and `lazyRouteManifest` options to your `reactRouterV6BrowserTracingIntegration` configuration. Keep the `lazyRouteManifest` array in sync with your route definitions. Any route that doesn't match a pattern in the manifest will fall back to the default behavior, which may result in incomplete transaction names until the route is visited.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Add the `enableAsyncRouteHandlers` and `lazyRouteManifest` options to your `reactRouterV6BrowserTracingIntegration` configuration. Keep the `lazyRouteManifest` array in sync with your route definitions. Any route that doesn't match a pattern in the manifest will fall back to the default behavior, which may result in incomplete transaction names until the route is visited.
Make sure to keep the `lazyRouteManifest` array in sync with your route definitions: if you add, remove, or change routes in your app, update this list accordingly. Any route that doesn't match a pattern in the manifest will fall back to the default behavior, which may result in incomplete transaction names until the route is visited.

Let's move the first sentence above the code snippet.
I also wanted to clarify what we mean by "in sync" but maybe that's not necessary -- just a suggestion :)

});
```

Add the `enableAsyncRouteHandlers` and `lazyRouteManifest` options to your `reactRouterV6BrowserTracingIntegration` configuration. Keep the `lazyRouteManifest` array in sync with your route definitions. Any route that doesn't match a pattern in the manifest will fall back to the default behavior, which may result in incomplete transaction names until the route is visited.
Copy link
Collaborator

Choose a reason for hiding this comment

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

q: in the SDK PR you wrote:

This manifest is primarily for lazy routes, but the users can also add their non-lazy routes here for convenience or consistency.

Do you think this is clear to our users, or should we also add this to the docs (maybe in a note alert)?


Now, Sentry should generate `pageload`/`navigation` transactions with parameterized transaction names (for example, `/teams/:teamid/user/:userid`), where applicable. This is only needed at the top level of your app, unlike React Router v4/v5, which required wrapping every `<Route />` you wanted parametrized.

## Static Route Manifest
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could it make sense to create an include for this?

`lazyRouteManifest` requires `enableAsyncRouteHandlers: true` to be set on the integration.

</Alert>

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add the explanation here:

Suggested change
To use `lazyRouteManifest`, you need to set `enableAsyncRouteHandlers: true` in your `reactRouterV6BrowserTracingIntegration` configuration:


## Static Route Manifest

_Available in `@sentry/react` version `10.39.0` and above._
Copy link
Member

Choose a reason for hiding this comment

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

There's a component for this!

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.

3 participants