-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(nextjs): Trace navigation transactions #5676
Conversation
size-limit report 📦
|
…tside-transitions
} | ||
} | ||
|
||
function getNextRouteFromPathname(pathname: string): string | void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not the biggest fan of union typing with void
- can we just union type with undefined and have an early return? (see microsoft/TypeScript#42709 on some larger issues with void that I share similar opinions on)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course! TIL 53b5021
readyCalled = true; | ||
return cb(); | ||
events: { | ||
on(type: string, handler: (...args: any[]) => void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also test if off
was called on the listener?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in a340b5c
Ref: #5505
Improves Next.js clientside tracing by starting transactions earlier. Previously, requests to Next.js data-fetchers were not instrumented with
baggage
andsentry-trace
headers because the requests were done before the navigation transaction was even started.To get earlier navigation transactions we make use of the
routeChangeStart
router event, which runs before the data fetching requests go out. Sadly, at that point in time, we have no real way of knowing which parameterized route the user will navigate to. To get around this, on navigation, we take a peek at the__BUILD_MANIFEST
global that Next.js defines. It contains a list of all parameterized routes we can use to match the navigation target against.