From a00b2cb45798af4dcf70a0d76acebf4547b9239b Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Fri, 13 Nov 2026 20:10:03 -0800 Subject: [PATCH 1/2] fix(apps): show an app page as not loaded, never as loading forever, when it is sent off the site or retried with nothing to reload Two ways an opened app could leave the person looking at the loading placeholder with no way out but All apps: - The site redirects the app's page to another site while it loads, as a www or locale redirect on comfy.org would. Desktop stopped the redirect, opened the other address in the browser unasked, and kept the status at loading, because the stopped load ends as an aborted navigation, which is ignored. Now a redirect off the apps site while the page loads stops it and reports the page as not loaded (telemetry reason "redirected"), so the panel offers Try again. A redirect after the page is up still opens in the browser, as before. - Try again on an app the window never loaded, because opening it was refused (Apps switched off, or the app gone from the list). Desktop had no page to reload and answered nothing. If the window still held another app, it reloaded that one out of sight and the panel showed a blank page. Try again now names the app it is for. Desktop reloads only that app's page, and otherwise tells the panel the app still did not load. Found in a read-through of the Apps hosting code before the release that turns Apps on (desktop_apps_enabled is at 100%). Neither happens with comfy.org as it answers today. --- src/main/apps/appPageView.test.ts | 37 +++++++++++++++++++++- src/main/apps/appPageView.ts | 25 +++++++++++---- src/main/lib/ipc/registerAppsHandlers.ts | 2 +- src/preload/api.ts | 2 +- src/renderer/src/panel/AppPageHost.test.ts | 2 +- src/renderer/src/panel/AppPageHost.vue | 2 +- src/types/ipc.ts | 2 +- 7 files changed, 60 insertions(+), 12 deletions(-) diff --git a/src/main/apps/appPageView.test.ts b/src/main/apps/appPageView.test.ts index c8bffe08d..90a32b491 100644 --- a/src/main/apps/appPageView.test.ts +++ b/src/main/apps/appPageView.test.ts @@ -484,7 +484,7 @@ describe('an app page that cannot load', () => { reason: 'network' }) - reloadAppPage(panelContents()) + reloadAppPage(panelContents(), CUTOUT) expect(lastStatusSentToPanel()).toBe('loading') expect(hostedPage().webContents.loadURL).toHaveBeenCalledTimes(2) expect(hostedPage().webContents.loadURL).toHaveBeenLastCalledWith(CUTOUT_URL) @@ -494,6 +494,41 @@ describe('an app page that cannot load', () => { expect(lastStatusSentToPanel()).toBe('ready') }) + it('says the page did not load, without opening the browser, when the site sends it to another site while it loads', async () => { + await openCutout() + const event = navigationEvent() + hostedPage().webContents.emit( + 'will-redirect', + event, + 'https://www.comfy.org/apps/', + false, + true + ) + + expect(event.preventDefault).toHaveBeenCalled() + expect(mocks.openExternal).not.toHaveBeenCalled() + expect(hostedPage().visible).toBe(false) + expect(lastStatusSentToPanel()).toBe('failed') + expect(mocks.capture).toHaveBeenCalledWith(APP_PAGE_FAILED_EVENT, { + app_id: CUTOUT, + reason: 'redirected' + }) + }) + + it('says the page still did not load when the person retries an app this window never loaded', async () => { + await openCutout() + finishLoading() + hideAppPage(panelContents()) + mocks.pages.delete(UPSCALE) + expect(await showAppPage(panelContents(), UPSCALE, PLACEMENT)).toBe('failed') + + reloadAppPage(panelContents(), UPSCALE) + + expect(lastStatusSentToPanel()).toBe('failed') + expect(hostedPage().webContents.loadURL).toHaveBeenCalledTimes(1) + expect(hostedPage().visible).toBe(false) + }) + it('tries a failed app again when the person opens it once more', async () => { await openCutout({ ...PLACEMENT, justOpened: true }) finishLoading(CUTOUT_URL, 503) diff --git a/src/main/apps/appPageView.ts b/src/main/apps/appPageView.ts index ca3ae4656..db1d476d1 100644 --- a/src/main/apps/appPageView.ts +++ b/src/main/apps/appPageView.ts @@ -26,7 +26,7 @@ const NAVIGATION_ABORTED = -3 const FIRST_HTTP_ERROR_STATUS = 400 const PAGE_PERMISSIONS: ReadonlySet = new Set(['clipboard-sanitized-write', 'fullscreen']) -type PageFailure = 'http_status' | 'network' | 'crashed' +type PageFailure = 'http_status' | 'network' | 'crashed' | 'redirected' interface HostedPage { view: WebContentsView @@ -171,7 +171,13 @@ function createHostedPage({ windowKey, entry }: PageHost, location: AppsLocation } contents.on('will-navigate', (event, url) => steer(event, url, true)) contents.on('will-redirect', (event, url, _isInPlace, isMainFrame) => { - if (isMainFrame) steer(event, url, false) + if (!isMainFrame) return + if (hosted.status === 'loading' && !isInAppsScope(location, url)) { + event.preventDefault() + fail(windowKey, hosted, 'redirected') + return + } + steer(event, url, false) }) contents.setWindowOpenHandler(({ url }) => { openOutside(url) @@ -311,11 +317,18 @@ export async function captureAppPage(panel: WebContents): Promise } } -export function reloadAppPage(panel: WebContents): void { +export function reloadAppPage(panel: WebContents, appId: unknown): void { const host = hostOf(panel) - const hosted = host && hostedFor(host) - const pageUrl = hosted?.appId ? pageUrlForListedApp(hosted.appId) : null - if (!host || !hosted || !pageUrl) return + if (!host) return + const hosted = hostedFor(host) + const pageUrl = + hosted && typeof appId === 'string' && hosted.appId === appId + ? pageUrlForListedApp(appId) + : null + if (!hosted || !pageUrl) { + panelOf(host.windowKey)?.send(APP_PAGE_STATUS_CHANNEL, 'failed') + return + } load(host.windowKey, hosted, pageUrl) } diff --git a/src/main/lib/ipc/registerAppsHandlers.ts b/src/main/lib/ipc/registerAppsHandlers.ts index bd3e6f7b2..4ae535767 100644 --- a/src/main/lib/ipc/registerAppsHandlers.ts +++ b/src/main/lib/ipc/registerAppsHandlers.ts @@ -21,5 +21,5 @@ export function registerAppsHandlers(): void { ipcMain.on('apps:hide-page', (event) => hideAppPage(event.sender)) - ipcMain.on('apps:reload-page', (event) => reloadAppPage(event.sender)) + ipcMain.on('apps:reload-page', (event, appId: unknown) => reloadAppPage(event.sender, appId)) } diff --git a/src/preload/api.ts b/src/preload/api.ts index 3d5b6b50e..4763ff72f 100644 --- a/src/preload/api.ts +++ b/src/preload/api.ts @@ -113,7 +113,7 @@ export function buildElectronApi(): ElectronApi { showAppPage: (appId, placement) => ipcRenderer.invoke('apps:show-page', appId, placement), captureAppPage: () => ipcRenderer.invoke('apps:capture-page'), hideAppPage: () => ipcRenderer.send('apps:hide-page'), - reloadAppPage: () => ipcRenderer.send('apps:reload-page'), + reloadAppPage: (appId) => ipcRenderer.send('apps:reload-page', appId), onAppPageStatusChanged: (callback) => { const handler = (_event: IpcRendererEvent, status: AppPageStatus): void => callback(status) ipcRenderer.on('apps:page-status-changed', handler) diff --git a/src/renderer/src/panel/AppPageHost.test.ts b/src/renderer/src/panel/AppPageHost.test.ts index 1d027fb4c..3ddceb85d 100644 --- a/src/renderer/src/panel/AppPageHost.test.ts +++ b/src/renderer/src/panel/AppPageHost.test.ts @@ -131,7 +131,7 @@ describe('AppPageHost', () => { await wrapper.get('[data-testid="app-page-retry"]').trigger('click') - expect(reloadAppPage).toHaveBeenCalledTimes(1) + expect(reloadAppPage).toHaveBeenCalledExactlyOnceWith('remove-background') expect(wrapper.get('[data-testid="app-page-loading"]').isVisible()).toBe(true) tellStatus('failed') diff --git a/src/renderer/src/panel/AppPageHost.vue b/src/renderer/src/panel/AppPageHost.vue index 7971167b7..41c074802 100644 --- a/src/renderer/src/panel/AppPageHost.vue +++ b/src/renderer/src/panel/AppPageHost.vue @@ -73,7 +73,7 @@ async function conceal(): Promise { function retry(): void { status.value = 'loading' - window.api.reloadAppPage() + window.api.reloadAppPage(appId) } watch(covered, (isCovered) => void (isCovered ? conceal() : reveal())) diff --git a/src/types/ipc.ts b/src/types/ipc.ts index 7e21ba80d..1b8faecfc 100644 --- a/src/types/ipc.ts +++ b/src/types/ipc.ts @@ -1182,7 +1182,7 @@ export interface ElectronApi { showAppPage(appId: string, placement: AppPagePlacement): Promise captureAppPage(): Promise hideAppPage(): void - reloadAppPage(): void + reloadAppPage(appId: string): void onAppPageStatusChanged(callback: (status: AppPageStatus) => void): () => void onAppPageClosed(callback: () => void): () => void getBuildStorageSnapshot(): Promise From 99ce695ff2680ff2f10b31cb41b6980704f46567 Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Sun, 15 Nov 2026 13:30:59 -0800 Subject: [PATCH 2/2] fix(apps): send Try again through opening the app, and name the app in every page status Review fixes on top of the redirect and retry change: - Try again now asks to show the app again, with a retry flag, instead of a separate reload channel. Opening the app already checks that Apps is on and the app is still listed, and it already reloads a failed page. So Try again no longer loads a page after Apps is switched off. An app refused for a reason that has since cleared now loads on Try again, instead of saying it failed every time. The retry is not counted as an app_opened event. The reload-page channel is gone. - Each page status sent to the panel names its app, and the panel uses only the status of the app it shows. Before this, if you left an app while it was still loading and then opened one that was refused, the first app finishing set the second app's panel to ready. The panel went blank with no Try again. - Adds a test that a redirect within the apps site while the page loads is still followed. --- src/main/apps/appPageView.test.ts | 58 +++++++++++++++++++--- src/main/apps/appPageView.ts | 34 ++++++------- src/main/lib/ipc/registerAppsHandlers.ts | 4 +- src/preload/api.ts | 7 ++- src/renderer/src/panel/AppPageHost.test.ts | 51 ++++++++++++++++--- src/renderer/src/panel/AppPageHost.vue | 12 +++-- src/renderer/src/panel/AppsView.test.ts | 1 - src/renderer/src/panel/PanelApp.test.ts | 1 - src/types/ipc.ts | 6 ++- 9 files changed, 128 insertions(+), 46 deletions(-) diff --git a/src/main/apps/appPageView.test.ts b/src/main/apps/appPageView.test.ts index 90a32b491..1c094fad9 100644 --- a/src/main/apps/appPageView.test.ts +++ b/src/main/apps/appPageView.test.ts @@ -63,7 +63,6 @@ import { _resetForTest, captureAppPage, hideAppPage, - reloadAppPage, showAppPage } from './appPageView' @@ -187,7 +186,7 @@ function sentToPanel(channel: string): unknown[][] { } function lastStatusSentToPanel(): unknown { - return sentToPanel(APP_PAGE_STATUS_CHANNEL).at(-1)?.[1] + return sentToPanel(APP_PAGE_STATUS_CHANNEL).at(-1)?.[2] } function openCutout(placement: Record = PLACEMENT): Promise { @@ -484,7 +483,7 @@ describe('an app page that cannot load', () => { reason: 'network' }) - reloadAppPage(panelContents(), CUTOUT) + expect(await openCutout({ ...PLACEMENT, retry: true })).toBe('loading') expect(lastStatusSentToPanel()).toBe('loading') expect(hostedPage().webContents.loadURL).toHaveBeenCalledTimes(2) expect(hostedPage().webContents.loadURL).toHaveBeenLastCalledWith(CUTOUT_URL) @@ -492,6 +491,19 @@ describe('an app page that cannot load', () => { finishLoading() expect(hostedPage().visible).toBe(true) expect(lastStatusSentToPanel()).toBe('ready') + expect(mocks.capture).not.toHaveBeenCalledWith(APP_OPENED_EVENT, expect.anything()) + }) + + it('follows a redirect that stays on the apps site while the page loads', async () => { + await openCutout() + const event = navigationEvent() + hostedPage().webContents.emit('will-redirect', event, `${CUTOUT_URL}?v=2`, false, true) + + expect(event.preventDefault).not.toHaveBeenCalled() + expect(mocks.capture).not.toHaveBeenCalledWith(APP_PAGE_FAILED_EVENT, expect.anything()) + + finishLoading(`${CUTOUT_URL}?v=2`) + expect(lastStatusSentToPanel()).toBe('ready') }) it('says the page did not load, without opening the browser, when the site sends it to another site while it loads', async () => { @@ -515,20 +527,54 @@ describe('an app page that cannot load', () => { }) }) - it('says the page still did not load when the person retries an app this window never loaded', async () => { + it('asks again whether a refused app may open when the person retries it, and loads it once it may', async () => { await openCutout() finishLoading() hideAppPage(panelContents()) mocks.pages.delete(UPSCALE) expect(await showAppPage(panelContents(), UPSCALE, PLACEMENT)).toBe('failed') - reloadAppPage(panelContents(), UPSCALE) + expect(await showAppPage(panelContents(), UPSCALE, { ...PLACEMENT, retry: true })).toBe( + 'failed' + ) + expect(hostedPage().webContents.loadURL).toHaveBeenCalledTimes(1) + expect(hostedPage().visible).toBe(false) - expect(lastStatusSentToPanel()).toBe('failed') + mocks.pages.set(UPSCALE, UPSCALE_URL) + expect(await showAppPage(panelContents(), UPSCALE, { ...PLACEMENT, retry: true })).toBe( + 'loading' + ) + expect(hostedPage().webContents.loadURL).toHaveBeenLastCalledWith(UPSCALE_URL) + finishLoading(UPSCALE_URL) + expect(hostedPage().visible).toBe(true) + }) + + it('does not load a failed app again on Try again once Apps is switched off', async () => { + await openCutout() + finishLoading(CUTOUT_URL, 503) + mocks.appsEnabled = false + + expect(await openCutout({ ...PLACEMENT, retry: true })).toBe('failed') expect(hostedPage().webContents.loadURL).toHaveBeenCalledTimes(1) expect(hostedPage().visible).toBe(false) }) + it("names the app with every status, so the panel can tell a hidden app's page from the one it shows", async () => { + await openCutout() + hideAppPage(panelContents()) + mocks.pages.delete(UPSCALE) + expect(await showAppPage(panelContents(), UPSCALE, PLACEMENT)).toBe('failed') + + finishLoading() + + expect(sentToPanel(APP_PAGE_STATUS_CHANNEL).at(-1)).toEqual([ + APP_PAGE_STATUS_CHANNEL, + CUTOUT, + 'ready' + ]) + expect(hostedPage().visible).toBe(false) + }) + it('tries a failed app again when the person opens it once more', async () => { await openCutout({ ...PLACEMENT, justOpened: true }) finishLoading(CUTOUT_URL, 503) diff --git a/src/main/apps/appPageView.ts b/src/main/apps/appPageView.ts index 83ffd95b7..a41b6d98d 100644 --- a/src/main/apps/appPageView.ts +++ b/src/main/apps/appPageView.ts @@ -101,7 +101,7 @@ function setStatus(windowKey: number, hosted: HostedPage, status: AppPageStatus) if (hosted.status === status) return hosted.status = status applyVisibility(hosted) - panelOf(windowKey)?.send(APP_PAGE_STATUS_CHANNEL, status) + panelOf(windowKey)?.send(APP_PAGE_STATUS_CHANNEL, hosted.appId, status) } function fail(windowKey: number, hosted: HostedPage, reason: PageFailure): void { @@ -224,10 +224,18 @@ function isMeasure(value: unknown): value is number { function parsePlacement(raw: unknown): AppPagePlacement | null { if (!raw || typeof raw !== 'object') return null - const { x, y, width, height, cornerRadius, justOpened } = raw as Record + const { x, y, width, height, cornerRadius, justOpened, retry } = raw as Record if (!isMeasure(x) || !isMeasure(y) || !isMeasure(width) || !isMeasure(height)) return null if (!isMeasure(cornerRadius)) return null - return { x, y, width, height, cornerRadius, justOpened: justOpened === true } + return { + x, + y, + width, + height, + cornerRadius, + justOpened: justOpened === true, + retry: retry === true + } } function place(entry: ComfyWindowEntry, view: WebContentsView, placement: AppPagePlacement): void { @@ -281,14 +289,15 @@ export async function showAppPage( if (!pageUrl || !host) return 'failed' const hosted = hostedFor(host) ?? createHostedPage(host, currentAppsLocation()) concealWhenPanelGoes(host.windowKey, panel) - const retriesFailedPage = placement.justOpened === true && hosted.status === 'failed' + const askedFresh = placement.justOpened === true || placement.retry === true + const retriesFailedPage = askedFresh && hosted.status === 'failed' if (hosted.appId !== appId || retriesFailedPage) { hosted.appId = appId load(host.windowKey, hosted, pageUrl) } if (placement.justOpened) mainTelemetry.capture(APP_OPENED_EVENT, { app_id: appId }) hosted.wanted = true - hosted.focusWhenReady = hosted.focusWhenReady || placement.justOpened === true + hosted.focusWhenReady = hosted.focusWhenReady || askedFresh place(host.entry, hosted.view, placement) raiseAbovePanel(host.entry, hosted.view) applyVisibility(hosted) @@ -313,21 +322,6 @@ export async function captureAppPage(panel: WebContents): Promise } } -export function reloadAppPage(panel: WebContents, appId: unknown): void { - const host = hostOf(panel) - if (!host) return - const hosted = hostedFor(host) - const pageUrl = - hosted && typeof appId === 'string' && hosted.appId === appId - ? pageUrlForListedApp(appId) - : null - if (!hosted || !pageUrl) { - panelOf(host.windowKey)?.send(APP_PAGE_STATUS_CHANNEL, 'failed') - return - } - load(host.windowKey, hosted, pageUrl) -} - export function _resetForTest(): void { hostedByWindow.clear() } diff --git a/src/main/lib/ipc/registerAppsHandlers.ts b/src/main/lib/ipc/registerAppsHandlers.ts index 4ae535767..3e7168cb6 100644 --- a/src/main/lib/ipc/registerAppsHandlers.ts +++ b/src/main/lib/ipc/registerAppsHandlers.ts @@ -1,6 +1,6 @@ import { ipcMain } from 'electron' -import { captureAppPage, hideAppPage, reloadAppPage, showAppPage } from '../../apps/appPageView' +import { captureAppPage, hideAppPage, showAppPage } from '../../apps/appPageView' import { listApps } from '../../apps/appsCatalog' import { areAppsEnabled } from '../../apps/appsConfig' import { isPanelSender } from '../../host/registry' @@ -20,6 +20,4 @@ export function registerAppsHandlers(): void { ipcMain.handle('apps:capture-page', (event) => captureAppPage(event.sender)) ipcMain.on('apps:hide-page', (event) => hideAppPage(event.sender)) - - ipcMain.on('apps:reload-page', (event, appId: unknown) => reloadAppPage(event.sender, appId)) } diff --git a/src/preload/api.ts b/src/preload/api.ts index 3a3b7c4e1..0822465fe 100644 --- a/src/preload/api.ts +++ b/src/preload/api.ts @@ -110,9 +110,12 @@ export function buildElectronApi(): ElectronApi { showAppPage: (appId, placement) => ipcRenderer.invoke('apps:show-page', appId, placement), captureAppPage: () => ipcRenderer.invoke('apps:capture-page'), hideAppPage: () => ipcRenderer.send('apps:hide-page'), - reloadAppPage: (appId) => ipcRenderer.send('apps:reload-page', appId), onAppPageStatusChanged: (callback) => { - const handler = (_event: IpcRendererEvent, status: AppPageStatus): void => callback(status) + const handler = ( + _event: IpcRendererEvent, + appId: string | null, + status: AppPageStatus + ): void => callback(appId, status) ipcRenderer.on('apps:page-status-changed', handler) return () => ipcRenderer.removeListener('apps:page-status-changed', handler) }, diff --git a/src/renderer/src/panel/AppPageHost.test.ts b/src/renderer/src/panel/AppPageHost.test.ts index 3ddceb85d..523d6a264 100644 --- a/src/renderer/src/panel/AppPageHost.test.ts +++ b/src/renderer/src/panel/AppPageHost.test.ts @@ -16,16 +16,19 @@ const FRAME = const showAppPage = vi.fn<(appId: string, placement: AppPagePlacement) => Promise>() const captureAppPage = vi.fn<() => Promise>() const hideAppPage = vi.fn() -const reloadAppPage = vi.fn() const mountPointFillsThePage = document.createElement('style') mountPointFillsThePage.textContent = '[data-apps-page] > div { display: flex; flex: 1 1 auto; }' document.head.append(mountPointFillsThePage) let page: HTMLElement -let tellStatus: (status: AppPageStatus) => void = () => {} +let tellStatusOf: (appId: string | null, status: AppPageStatus) => void = () => {} let stoppedListening = false +function tellStatus(status: AppPageStatus): void { + tellStatusOf('remove-background', status) +} + async function nextFrame(): Promise { await new Promise((resolve) => requestAnimationFrame(() => resolve())) await flushPromises() @@ -63,9 +66,8 @@ beforeEach(() => { showAppPage, captureAppPage, hideAppPage, - reloadAppPage, - onAppPageStatusChanged: (listener: (status: AppPageStatus) => void) => { - tellStatus = listener + onAppPageStatusChanged: (listener: (appId: string | null, status: AppPageStatus) => void) => { + tellStatusOf = listener return () => { stoppedListening = true } @@ -88,7 +90,8 @@ describe('AppPageHost', () => { width: PAGE_WIDTH, height: PAGE_HEIGHT, cornerRadius: 14, - justOpened: true + justOpened: true, + retry: false }) }) @@ -129,9 +132,15 @@ describe('AppPageHost', () => { "Remove Background didn't load" ) + showAppPage.mockClear() + showAppPage.mockResolvedValue('loading') await wrapper.get('[data-testid="app-page-retry"]').trigger('click') + await flushPromises() - expect(reloadAppPage).toHaveBeenCalledExactlyOnceWith('remove-background') + expect(showAppPage).toHaveBeenCalledExactlyOnceWith( + 'remove-background', + expect.objectContaining({ justOpened: false, retry: true }) + ) expect(wrapper.get('[data-testid="app-page-loading"]').isVisible()).toBe(true) tellStatus('failed') @@ -141,6 +150,34 @@ describe('AppPageHost', () => { expect(wrapper.emitted('close')).toHaveLength(1) }) + it('asks for a fresh load only on the Try again that was pressed, not on the next resize', async () => { + const wrapper = await mountHost('failed') + showAppPage.mockResolvedValue('loading') + await wrapper.get('[data-testid="app-page-retry"]').trigger('click') + await flushPromises() + showAppPage.mockClear() + + page.style.width = `${PAGE_WIDTH - 180}px` + await nextFrame() + await nextFrame() + + expect(showAppPage).toHaveBeenLastCalledWith( + 'remove-background', + expect.objectContaining({ justOpened: false, retry: false }) + ) + }) + + it("keeps saying the app did not load when another app's hidden page finishes", async () => { + const wrapper = await mountHost('failed') + + tellStatusOf('upscale', 'ready') + tellStatusOf(null, 'loading') + await flushPromises() + + expect(wrapper.get('[data-testid="app-page-failed"]').isVisible()).toBe(true) + expect(wrapper.get('[data-testid="app-page-host"]').attributes('data-status')).toBe('failed') + }) + it('follows the host when it is resized, without counting another opening', async () => { await mountHost() showAppPage.mockClear() diff --git a/src/renderer/src/panel/AppPageHost.vue b/src/renderer/src/panel/AppPageHost.vue index dc5893e11..642e04937 100644 --- a/src/renderer/src/panel/AppPageHost.vue +++ b/src/renderer/src/panel/AppPageHost.vue @@ -23,6 +23,7 @@ const status = ref(null) const frozenFrame = ref(null) let justOpened = true +let retrying = false let latestTurn = 0 let stopStatusUpdates: (() => void) | null = null @@ -38,9 +39,11 @@ function takePlacement(): AppPagePlacement | null { width: rect.width, height: rect.height, cornerRadius, - justOpened + justOpened, + retry: retrying } justOpened = false + retrying = false return placement } @@ -73,7 +76,8 @@ async function conceal(): Promise { function retry(): void { status.value = 'loading' - window.api.reloadAppPage(appId) + retrying = true + void reveal() } watch(covered, (isCovered) => void (isCovered ? conceal() : reveal())) @@ -93,8 +97,8 @@ useResizeObserver(host, () => { }) onMounted(() => { - stopStatusUpdates = window.api.onAppPageStatusChanged((next) => { - status.value = next + stopStatusUpdates = window.api.onAppPageStatusChanged((pageAppId, next) => { + if (pageAppId === appId) status.value = next }) if (!covered.value) void reveal() }) diff --git a/src/renderer/src/panel/AppsView.test.ts b/src/renderer/src/panel/AppsView.test.ts index 327ef052b..2ee89002e 100644 --- a/src/renderer/src/panel/AppsView.test.ts +++ b/src/renderer/src/panel/AppsView.test.ts @@ -74,7 +74,6 @@ beforeEach(() => { showAppPage, captureAppPage: vi.fn().mockResolvedValue(null), hideAppPage, - reloadAppPage: vi.fn(), onAppPageStatusChanged: vi.fn(() => () => {}), onAppPageClosed: (listener: () => void) => { appPageClosed = listener diff --git a/src/renderer/src/panel/PanelApp.test.ts b/src/renderer/src/panel/PanelApp.test.ts index 89f7cce75..f7fc00b63 100644 --- a/src/renderer/src/panel/PanelApp.test.ts +++ b/src/renderer/src/panel/PanelApp.test.ts @@ -399,7 +399,6 @@ function installMockApi(initial?: { showAppPage: vi.fn(async () => 'loading'), captureAppPage: vi.fn(async () => null), hideAppPage: vi.fn(), - reloadAppPage: vi.fn(), onAppPageStatusChanged: vi.fn(() => () => {}), onAppPageClosed: vi.fn(() => () => {}), getListActions: vi.fn(async () => []), diff --git a/src/types/ipc.ts b/src/types/ipc.ts index 946f065ee..f2e198dd9 100644 --- a/src/types/ipc.ts +++ b/src/types/ipc.ts @@ -145,6 +145,7 @@ export interface AppPagePlacement { height: number cornerRadius: number justOpened?: boolean + retry?: boolean } export interface CatalogWorkflow { @@ -1170,8 +1171,9 @@ export interface ElectronApi { showAppPage(appId: string, placement: AppPagePlacement): Promise captureAppPage(): Promise hideAppPage(): void - reloadAppPage(appId: string): void - onAppPageStatusChanged(callback: (status: AppPageStatus) => void): () => void + onAppPageStatusChanged( + callback: (appId: string | null, status: AppPageStatus) => void + ): () => void onAppPageClosed(callback: () => void): () => void getBuildStorageSnapshot(): Promise resolveStartupRestoreReveal(result: 'takeover-ready' | 'dashboard-fallback'): void