Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(react): Improve React Router v6 error message #5853

Merged
merged 2 commits into from Sep 29, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/react/src/reactrouterv6.tsx
Expand Up @@ -190,7 +190,9 @@ export function withSentryReactRouterV6Routing<P extends Record<string, any>, R
!_customStartTransaction
) {
__DEBUG_BUILD__ &&
logger.warn('reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.');
logger.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.
useEffect: ${_useEffect}. useLocation: ${_useLocation}. useNavigationType: ${_useNavigationType}.
createRoutesFromChildren: ${_createRoutesFromChildren}. matchRoutes: ${_matchRoutes}. customStartTransaction: ${_customStartTransaction}.`);

return Routes;
}
Expand All @@ -203,9 +205,9 @@ export function withSentryReactRouterV6Routing<P extends Record<string, any>, R
const navigationType = _useNavigationType();

_useEffect(() => {
// Performance concern:
// This is repeated when <Routes /> is rendered.
routes = _createRoutesFromChildren(props.children);
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's actually repeated internally by React Router 6. So caching doesn't fix it. But I don't think there is anything we can do anyways 🤷

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed!

if (!routes) {
routes = _createRoutesFromChildren(props.children);
}
AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved
isBaseLocation = true;

updatePageloadTransaction(location, routes);
Expand Down