From 707ac6f40893f4b9c144a5556058c0eebc39caa5 Mon Sep 17 00:00:00 2001 From: Isaac Sanchez-Hawkins <266845420+isanchez404@users.noreply.github.com> Date: Tue, 12 May 2026 03:58:16 -0400 Subject: [PATCH] fix(desktop): finish empty app scans (#1222) * fix(desktop): finish empty app scans * fix(desktop): keep app scan retries active after failures --------- Co-authored-by: Isaac Sanchez --- packages/ui/src/stores/useOpenInAppsStore.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/stores/useOpenInAppsStore.ts b/packages/ui/src/stores/useOpenInAppsStore.ts index 6ecbb3b8..7351f757 100644 --- a/packages/ui/src/stores/useOpenInAppsStore.ts +++ b/packages/ui/src/stores/useOpenInAppsStore.ts @@ -64,9 +64,9 @@ export const useOpenInAppsStore = create()((set, get) => ({ } initialized = true; - const applyInstalledApps = (installed: InstalledDesktopAppInfo[]) => { + const applyInstalledApps = (installed: InstalledDesktopAppInfo[], hasLoadedApps = true) => { if (!Array.isArray(installed) || installed.length === 0) { - set({ availableApps: getAlwaysAvailableApps(), hasLoadedApps: false }); + set({ availableApps: getAlwaysAvailableApps(), hasLoadedApps }); return; } @@ -118,11 +118,13 @@ export const useOpenInAppsStore = create()((set, get) => ({ isCacheStale, } = await fetchDesktopInstalledApps(appNames, force); + const shouldRetryEmptyScan = success && !hasCache && installed.length === 0 && retryAttempt < 3; + set({ isCacheStale: hasCache ? isCacheStale : false }); - applyInstalledApps(installed); + applyInstalledApps(installed, success ? !shouldRetryEmptyScan : false); if (success) { - if (!hasCache && installed.length === 0 && retryAttempt < 3) { + if (shouldRetryEmptyScan) { const delays = [800, 1600, 3200]; const delay = delays[retryAttempt] ?? 3200; retryAttempt += 1;