fix(browser): remote profile tab ops follow-up (#1060) (thanks @mukhtharcm)

Landed via follow-up to #1057.

Gate: pnpm lint && pnpm build && pnpm test
This commit is contained in:
Peter Steinberger
2026-01-17 01:28:22 +00:00
committed by GitHub
parent e16ce1a0a1
commit a76cbc43bb
8 changed files with 232 additions and 48 deletions

View File

@@ -1,6 +1,8 @@
import type express from "express";
import type { BrowserRouteContext, ProfileContext } from "../server-context.js";
import type { PwAiModule } from "../pw-ai-module.js";
import { getPwAiModule as getPwAiModuleBase } from "../pw-ai-module.js";
import { getProfileContext, jsonError } from "./utils.js";
export const SELECTOR_UNSUPPORTED_MESSAGE = [
@@ -38,20 +40,8 @@ export function resolveProfileContext(
return profileCtx;
}
export type PwAiModule = typeof import("../pw-ai.js");
let pwAiModule: Promise<PwAiModule | null> | null = null;
export async function getPwAiModule(): Promise<PwAiModule | null> {
if (pwAiModule) return pwAiModule;
pwAiModule = (async () => {
try {
return await import("../pw-ai.js");
} catch {
return null;
}
})();
return pwAiModule;
return await getPwAiModuleBase({ mode: "soft" });
}
export async function requirePwAi(