Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Prevent redundant checks during desktop update download

Julius Marminge605e8143e092
diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts
index e89cecbe9..9b7770a61 100644
--- a/apps/desktop/src/main.ts
+++ b/apps/desktop/src/main.ts
@@ -576,6 +576,12 @@ function shouldEnableAutoUpdates(): boolean {
async function checkForUpdates(reason: string): Promise<void> {
if (!updaterConfigured || updateCheckInFlight) return;
+ if (updateState.status === "downloading" || updateState.status === "downloaded") {
+ console.info(
+ `[desktop-updater] Skipping update check (${reason}) while status=${updateState.status}.`,
+ );
+ return;
+ }
updateCheckInFlight = true;
setUpdateState({
status: "checking",
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx
index 46f5ab3fa..b6d49e235 100644
--- a/apps/web/src/components/Sidebar.tsx
+++ b/apps/web/src/components/Sidebar.tsx
@@ -812,18 +812,21 @@ export default function Sidebar() {
}
let disposed = false;
+ let receivedSubscriptionUpdate = false;
+ const unsubscribe = bridge.onUpdateState((nextState) => {
+ if (disposed) return;
+ receivedSubscriptionUpdate = true;
+ setDesktopUpdateState(nextState);
+ });
+
void bridge
.getUpdateState()
.then((nextState) => {
- if (disposed) return;
+ if (disposed || receivedSubscriptionUpdate) return;
setDesktopUpdateState(nextState);
})
.catch(() => undefined);
- const unsubscribe = bridge.onUpdateState((nextState) => {
- setDesktopUpdateState(nextState);
- });
-
return () => {
disposed = true;
unsubscribe();