Simplify perf seed reload helper return contract

Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Cursor AgentandJulius Marminge authored and Julius Marminge committed 2026-02-17 19:49:54 -08:00
1 parent ae6712b904
commit cdf7b01f01
1 file changed
+2 -13
+2 -13
View File
@@ -405,26 +405,15 @@ function buildPerfSeedState(): PerfPersistedState {
async function seedRendererState(
window: BrowserWindow,
state: unknown,
): Promise<{ projects: number; threads: number }> {
): Promise<void> {
const script = `
(() => {
const key = "t3code:renderer-state:v7";
localStorage.setItem(key, JSON.stringify(${JSON.stringify(state)}));
let projects = -1;
let threads = -1;
try {
const persisted = JSON.parse(localStorage.getItem(key) ?? "null");
projects = Array.isArray(persisted?.projects) ? persisted.projects.length : 0;
threads = Array.isArray(persisted?.threads) ? persisted.threads.length : 0;
} catch {
projects = -1;
threads = -1;
}
window.location.reload();
return { projects, threads };
})();
`;
return window.webContents.executeJavaScript(script, true);
await window.webContents.executeJavaScript(script, true);
}
async function readRendererPersistedThreadCount(window: BrowserWindow): Promise<number> {