Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/daemon/src/command-dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,11 @@ async function resolveTabByDomain(
}
}

// No matching tab — create one and wait for initial load
// No matching tab — create one (in the background: never steal the user's
// active tab) and wait for initial load
const created = await cdp.browserCommand<{ targetId: string }>(
"Target.createTarget",
{ url: `https://${domain}` },
{ url: `https://${domain}`, background: true },
);
await cdp.attachAndEnable(created.targetId);

Expand Down
5 changes: 3 additions & 2 deletions packages/daemon/src/site-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,12 @@ export async function executeSiteAdapter(
}
}

// No matching tab found — create one
// No matching tab found — create one in the BACKGROUND so the user's
// currently active tab is not switched away from.
if (!targetId) {
const created = await cdp.browserCommand<{ targetId: string }>(
"Target.createTarget",
{ url: `https://${site.domain}` },
{ url: `https://${site.domain}`, background: true },
);
await cdp.attachAndEnable(created.targetId);
targetId = created.targetId;
Expand Down