Skip to content

Commit 2ac1063

Browse files
chargomeclaude
andcommitted
docs(nextjs): Correct what a navigation during the pageload wait does
The Next.js routing instrumentation never flags a navigation as a redirect, so a navigation during the wait ends the pageload like any pageload it interrupts and starts its own trace, as it does today. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 1ae9f0e commit 2ac1063

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎packages/nextjs/src/client/browserTracingIntegration.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ export function browserTracingIntegration(
4343
}
4444

4545
// Registered before the browser tracing integration's own handler, which creates the navigation
46-
// span: a pageload that is still waiting for its trace meta tag has to exist by then so the
47-
// navigation can be filed as its redirect.
46+
// span: a pageload that is still waiting for its trace meta tag has to exist by then, so the
47+
// handler ends it like any pageload a navigation interrupts. Started later, the pageload would
48+
// end the navigation span instead.
4849
if (instrumentPageLoad) {
4950
client.on('startNavigationSpan', settlePendingPageloadWait);
5051
}

‎packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ let pendingPageloadWait: TraceMetaTagWait | undefined;
108108

109109
/**
110110
* Starts a pageload that is still waiting for its trace meta tag with a fresh trace. Called when a
111-
* navigation starts, before the navigation span is created, so that the navigation is filed as a
112-
* redirect of this pageload rather than becoming the only record of the visit.
111+
* navigation starts, before the navigation span is created, so the navigation ends the pageload like
112+
* any pageload it interrupts, and the pageload is still recorded.
113113
*/
114114
export function settlePendingPageloadWait(): void {
115115
pendingPageloadWait?.giveUp();

0 commit comments

Comments
 (0)