From e97bfc332635235b75438048733389e4234d479d Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Sun, 15 Nov 2026 22:43:14 -0800 Subject: [PATCH 1/2] fix(home): keep a starting build's name readable when Home shows three builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With three builds on Home each card is about 300px wide. A build that is starting, installing or uninstalling put View logs and Cancel inside its card next to the device art, which left about 16px for the status, name and detail, so they all cut down to "St…", "Co…". The busy card now measures itself. Under 448px, the two buttons move to the row under the card, where the other cards show Auto start, and the text gets the card's full width. Wider cards (two builds, as in the "Home, installing" frame) keep the buttons inline. The card measures the fixed-height bordered box rather than its wrapper, so moving the buttons never changes the observed size and Chrome does not report a ResizeObserver loop. --- src/renderer/src/panel/HomeView.test.ts | 85 +++++++++++ .../src/panel/home/HomeBuildBusyActions.vue | 37 +++++ src/renderer/src/panel/home/HomeBuildCard.vue | 134 +++++++++--------- 3 files changed, 189 insertions(+), 67 deletions(-) create mode 100644 src/renderer/src/panel/home/HomeBuildBusyActions.vue diff --git a/src/renderer/src/panel/HomeView.test.ts b/src/renderer/src/panel/HomeView.test.ts index fc8ac48d0..da87d474f 100644 --- a/src/renderer/src/panel/HomeView.test.ts +++ b/src/renderer/src/panel/HomeView.test.ts @@ -677,6 +677,91 @@ describe('Home builds', () => { }) }) +describe('Home build card while a build starts', () => { + let observers: { target?: Element; report: (width: number) => void }[] + const originalResizeObserver = globalThis.ResizeObserver + + beforeEach(() => { + observers = [] + globalThis.ResizeObserver = class { + private readonly entry: { target?: Element; report: (width: number) => void } + constructor(callback: ResizeObserverCallback) { + this.entry = { + report: (width) => + callback( + [ + { + target: this.entry.target!, + contentRect: { width, height: 136 } as DOMRectReadOnly, + contentBoxSize: [{ inlineSize: width, blockSize: 136 }], + borderBoxSize: [{ inlineSize: width, blockSize: 136 }], + devicePixelContentBoxSize: [] + } as unknown as ResizeObserverEntry + ], + this as unknown as ResizeObserver + ) + } + observers.push(this.entry) + } + observe(target: Element) { + this.entry.target = target + } + unobserve() {} + disconnect() {} + } as unknown as typeof ResizeObserver + Object.assign(window.api, { + onInstallProgress: vi.fn(() => () => {}), + onComfyOutput: vi.fn(() => () => {}), + cancelOperation: vi.fn(), + stopComfyUI: vi.fn() + }) + }) + + afterEach(() => { + globalThis.ResizeObserver = originalResizeObserver + }) + + async function startBuildBesideTwoOthers(cardWidth: number) { + getInstallations.mockResolvedValue([OLDEST, CLOUD, NEWEST]) + const wrapper = await openHome() + useProgressStore().startOperation({ + installationId: NEWEST.id, + title: 'Starting', + opKind: 'launch', + apiCall: () => new Promise(() => {}) + }) + await flushPromises() + const starting = wrapper.get('[data-testid="home-build-starting"]') + const card = starting.get('[data-testid="home-build-busy-card"]') + for (const observer of observers) { + if (observer.target === card.element) observer.report(cardWidth) + } + await flushPromises() + return { wrapper, starting } + } + + it('moves View logs and Cancel under a card in a row of three, so its name and status keep the room', async () => { + const { starting } = await startBuildBesideTwoOthers(300) + + const card = starting.get('[data-testid="home-build-busy-card"]') + expect(card.find('[data-testid="home-build-cancel"]').exists()).toBe(false) + expect(card.find('[data-testid="home-build-view-logs"]').exists()).toBe(false) + expect(card.text()).toContain('Starting ComfyUI') + expect(card.text()).toContain(NEWEST.name) + + await starting.get('[data-testid="home-build-cancel"]').trigger('click') + expect(window.api.cancelOperation).toHaveBeenCalledWith(NEWEST.id) + }) + + it('keeps View logs and Cancel inside a card that has room for them', async () => { + const { starting } = await startBuildBesideTwoOthers(560) + + const card = starting.get('[data-testid="home-build-busy-card"]') + expect(card.find('[data-testid="home-build-view-logs"]').exists()).toBe(true) + expect(card.find('[data-testid="home-build-cancel"]').exists()).toBe(true) + }) +}) + describe('Home build auto start', () => { let saved: unknown let settingsListeners: Array<(change: { key: string }) => void> diff --git a/src/renderer/src/panel/home/HomeBuildBusyActions.vue b/src/renderer/src/panel/home/HomeBuildBusyActions.vue new file mode 100644 index 000000000..bb47cea25 --- /dev/null +++ b/src/renderer/src/panel/home/HomeBuildBusyActions.vue @@ -0,0 +1,37 @@ + + + diff --git a/src/renderer/src/panel/home/HomeBuildCard.vue b/src/renderer/src/panel/home/HomeBuildCard.vue index b5225f5c3..c24c24fe0 100644 --- a/src/renderer/src/panel/home/HomeBuildCard.vue +++ b/src/renderer/src/panel/home/HomeBuildCard.vue @@ -1,9 +1,10 @@