Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
perf(updater): defer backend update check to browser idle
Akarshan Biswas13b80845e76e
diff --git a/web-app/src/containers/dialogs/BackendUpdater.tsx b/web-app/src/containers/dialogs/BackendUpdater.tsxindex c57e72abf..bb23f4f55 100644--- a/web-app/src/containers/dialogs/BackendUpdater.tsx+++ b/web-app/src/containers/dialogs/BackendUpdater.tsx@@ -31,9 +31,18 @@ const BackendUpdater = () => {// Check when the shell mounts or when the llamacpp provider is toggled on/off.// Skipped when auto-update is disabled — users opt into checks via the manual// "Check for Updates" button in provider settings.+ // Deferred to browser idle (after first paint) so the network round-trip+ // doesn't compete with the initial render.useEffect(() => {if (!updateState.autoUpdateEnabled) return- checkForUpdate()+ const ric = window.requestIdleCallback+ const idleHandle = ric+ ? ric(() => checkForUpdate(), { timeout: 3000 })+ : window.setTimeout(() => checkForUpdate(), 0)+ return () => {+ if (ric) window.cancelIdleCallback(idleHandle as number)+ else window.clearTimeout(idleHandle as number)+ }}, [checkForUpdate, isLlamacppEnabled, updateState.autoUpdateEnabled])const [backendUpdateState, setBackendUpdateState] = useState({