feat(desktop): download updates in the background and install them on quit #17588
main fromt3/desktop-background-updatesopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/desktop/src/updates/DesktopUpdates.ts line 535OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -516,3 +519,17 @@516519 );517520 }).pipe(Effect.withSpan("desktop.updates.downloadAvailableUpdate"));518521522+ // update-available fires inside the check that found it, so the download523+ // waits for that check to release the updater. Installing stays gated: the524+ // app's server relaunches into it when idle, and quitting installs it.525+ const downloadInBackground = Effect.scoped(526+ Effect.gen(function* () {527+ const completions = yield* PubSub.subscribe(finishedUpdateActions);528+ while (Option.isSome(yield* activeUpdateAction)) {529+ yield* PubSub.take(completions);530+ }531+ if (yield* Ref.get(desktopState.quitting)) return;532+ yield* downloadAvailableUpdate;533+ }),534+ ).pipe(535+ Effect.timeout(BACKGROUND_DOWNLOAD_START_WAIT),
- apps/desktop/src/updates/DesktopUpdates.ts line 535OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -516,3 +519,17 @@516519 );517520 }).pipe(Effect.withSpan("desktop.updates.downloadAvailableUpdate"));518521522+ // update-available fires inside the check that found it, so the download523+ // waits for that check to release the updater. Installing stays gated: the524+ // app's server relaunches into it when idle, and quitting installs it.525+ const downloadInBackground = Effect.scoped(526+ Effect.gen(function* () {527+ const completions = yield* PubSub.subscribe(finishedUpdateActions);528+ while (Option.isSome(yield* activeUpdateAction)) {529+ yield* PubSub.take(completions);530+ }531+ if (yield* Ref.get(desktopState.quitting)) return;532+ yield* downloadAvailableUpdate;533+ }),534+ ).pipe(535+ Effect.timeout(BACKGROUND_DOWNLOAD_START_WAIT),docs/user/updating.md line 85OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -82,5 +82,4 @@8282 provider CLI updates that have a one-click update;8383 the newest T3 Code release on its channel, when it runs as a background service8484 (`t3 service install`). It downloads first and restarts only inside that window;85-a desktop app update that has finished downloading, when no desktop window is86- focused or the machine has been idle for 15 minutes.85+a desktop app update, which downloads in the background as soon as it is
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
maria-rcks changed the title
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XXL
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/desktop/src/updates/DesktopUpdates.ts line 1106OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1065,3 +1099,8 @@1065109910661100 yield* electronUpdater.setAutoDownload(false);10671101 yield* electronUpdater.setAutoInstallOnAppQuit(false);1102+ // Register before downloading: electron-updater adds its synchronous1103+ // installer to this same event only after a download completes.1104+ yield* electronUpdater.onInstallOnAppQuit(() => {1105+ const { downloadedVersion } = Effect.runSync(Ref.get(updateStateRef));1106+ if (downloadedVersion === null) return;
juliusmarminge assignedjuliusmarminge
tanstack-source added labelsfeature
Sign in to join this conversation.



macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed