fix(browser): preserve handler-supplied URLs and Chrome tab titles

Address two review findings on the browser URL enrichment:

1. withRouteTabContext now only fills in url when the handler didn't
   already set one (record.url === undefined). This prevents clobbering
   post-navigation URLs returned by /navigate and similar handlers.

2. Chrome extension tabs.onUpdated listener now falls back to
   chrome.tabs.get() for the current title when changeInfo.title is
   undefined (URL-only changes), preventing relay cache title wipes.
This commit is contained in:
zeroaltitude 2026-02-28 22:22:13 -07:00
parent a66693b025
commit 43a670f095
No known key found for this signature in database
GPG Key ID: 77592FB1C703882E

View File

@ -150,9 +150,10 @@ export async function withRouteTabContext<T>(
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;
}
}