[codex] Lazy-load desktop E2E bridge (#262)

This commit is contained in:
Wes
2026-04-07 15:42:30 -07:00
committed by GitHub
parent ef15e38730
commit ed6bb7dc0a
+32 -11
View File
@@ -4,9 +4,10 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { App } from "@/app/App";
import "@/shared/styles/globals.css";
import { ThemeProvider } from "@/shared/theme/ThemeProvider";
import { maybeInstallE2eTauriMocks } from "@/testing/e2eBridge";
maybeInstallE2eTauriMocks();
type E2eWindow = Window & {
__SPROUT_E2E__?: unknown;
};
const queryClient = new QueryClient({
defaultOptions: {
@@ -22,12 +23,32 @@ const queryClient = new QueryClient({
},
});
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<ThemeProvider defaultTheme="houston">
<App />
</ThemeProvider>
</QueryClientProvider>
</React.StrictMode>,
);
function renderApp() {
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<ThemeProvider defaultTheme="houston">
<App />
</ThemeProvider>
</QueryClientProvider>
</React.StrictMode>,
);
}
async function installE2eBridgeIfConfigured() {
// Keep the large E2E bridge out of the normal startup path and production
// bundle; only load it when tests explicitly inject an E2E config.
if (!(window as E2eWindow).__SPROUT_E2E__) {
return;
}
const { maybeInstallE2eTauriMocks } = await import("@/testing/e2eBridge");
maybeInstallE2eTauriMocks();
}
async function bootstrap() {
await installE2eBridgeIfConfigured();
renderApp();
}
void bootstrap();