diff --git a/src/browser/routes/agent.shared.ts b/src/browser/routes/agent.shared.ts index 97d77f1dbb9..abf2b566c60 100644 --- a/src/browser/routes/agent.shared.ts +++ b/src/browser/routes/agent.shared.ts @@ -150,9 +150,10 @@ export async function withRouteTabContext( if (record.targetId === undefined) { record.targetId = tab.targetId; } - if (resolvedUrl) { - // Always override url with live value — the route may have used a - // stale tab.url from the relay cache. + if (record.url === undefined && resolvedUrl) { + // Only fill in url when the handler didn't already set one. + // Handlers like /navigate return the post-navigation URL which + // should not be clobbered with the pre-run tab URL. record.url = resolvedUrl; } }