Release 3.8.2.5: cheaper idle UI poll and tighter hot paths.
Delta getState by rev, pause when hidden, cancellable background loops, hostCache bounds, unlock PollUI around engine status, corebin singleflight, PingAll worker pool. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+19
-3
@@ -1,4 +1,4 @@
|
||||
// HTTP bridge for macOS GUI (Windows WebView2 already binds these as natives).
|
||||
// HTTP bridge for glaze GUI (Windows + macOS): POST /api/<method>.
|
||||
(function () {
|
||||
const methods = [
|
||||
"getState","getEditState","connect","disconnect","connectProfile","saveProfile","createProfile",
|
||||
@@ -208,6 +208,7 @@
|
||||
}
|
||||
|
||||
let listFP = "";
|
||||
let stateRev = "";
|
||||
|
||||
function profilesFingerprint(state) {
|
||||
const parts = [
|
||||
@@ -444,13 +445,22 @@
|
||||
}
|
||||
|
||||
async function refresh(opts) {
|
||||
const force = !!(opts && opts.force);
|
||||
if (document.hidden && !force && !(opts && opts.syncForm)) {
|
||||
return null;
|
||||
}
|
||||
const needSecrets = !!(opts && opts.syncForm) || (!formHydrated && !dirty);
|
||||
let state;
|
||||
if (needSecrets && typeof getEditState === "function") {
|
||||
state = await getEditState();
|
||||
} else {
|
||||
state = await getState();
|
||||
state = await getState(stateRev || "");
|
||||
}
|
||||
if (state && state.unchanged) {
|
||||
if (state.rev) stateRev = state.rev;
|
||||
return state;
|
||||
}
|
||||
if (state && state.rev) stateRev = state.rev;
|
||||
paint(state, opts);
|
||||
return state;
|
||||
}
|
||||
@@ -697,5 +707,11 @@
|
||||
setMeta(String(e), "err");
|
||||
}
|
||||
})();
|
||||
setInterval(() => { if (!busy && !modal.classList.contains("open")) refresh().catch(() => {}); }, 4000);
|
||||
setInterval(() => {
|
||||
if (document.hidden || busy || modal.classList.contains("open")) return;
|
||||
refresh().catch(() => {});
|
||||
}, 4000);
|
||||
document.addEventListener("visibilitychange", () => {
|
||||
if (!document.hidden && !busy) refresh({ force: true }).catch(() => {});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user