Scope perf bootstrap skip to explicit automation sessions
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
1 parent
c989631657
commit
3e589406dd
3 files changed
+16
-4
No files matched your search
@@ -409,7 +409,6 @@ async function seedRendererState(
|
||||
const script = `
|
||||
(() => {
|
||||
const key = "t3code:renderer-state:v7";
|
||||
localStorage.setItem("t3code:perf-bootstrap-skip", "1");
|
||||
localStorage.setItem(key, JSON.stringify(${JSON.stringify(state)}));
|
||||
let projects = -1;
|
||||
let threads = -1;
|
||||
|
||||
@@ -256,7 +256,11 @@ function createWindow(): BrowserWindow {
|
||||
});
|
||||
|
||||
if (isDevelopment) {
|
||||
void window.loadURL(process.env.VITE_DEV_SERVER_URL as string);
|
||||
const devUrl = new URL(process.env.VITE_DEV_SERVER_URL as string);
|
||||
if (PERF_AUTOMATION_ENABLED) {
|
||||
devUrl.searchParams.set("t3code_perf_automation", "1");
|
||||
}
|
||||
void window.loadURL(devUrl.toString());
|
||||
if (!PERF_AUTOMATION_ENABLED) {
|
||||
window.webContents.openDevTools({ mode: "detach" });
|
||||
}
|
||||
@@ -264,7 +268,13 @@ function createWindow(): BrowserWindow {
|
||||
if (!fs.existsSync(WEB_ENTRY)) {
|
||||
throw new Error(`Web bundle missing at ${WEB_ENTRY}`);
|
||||
}
|
||||
void window.loadFile(WEB_ENTRY);
|
||||
if (PERF_AUTOMATION_ENABLED) {
|
||||
void window.loadFile(WEB_ENTRY, {
|
||||
query: { t3code_perf_automation: "1" },
|
||||
});
|
||||
} else {
|
||||
void window.loadFile(WEB_ENTRY);
|
||||
}
|
||||
}
|
||||
|
||||
window.on("closed", () => {
|
||||
|
||||
@@ -129,7 +129,10 @@ function DesktopProjectBootstrap() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!isElectron || !api || bootstrappedRef.current) return;
|
||||
if (window.localStorage.getItem("t3code:perf-bootstrap-skip") === "1") {
|
||||
|
||||
const perfAutomationSession =
|
||||
new URLSearchParams(window.location.search).get("t3code_perf_automation") === "1";
|
||||
if (perfAutomationSession) {
|
||||
bootstrappedRef.current = true;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user