Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(preview): restore comparison after live activity
Josh Corbett4497949f6de1
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsxindex de65120933..4fae43dbbb 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsx@@ -100,11 +100,14 @@ export const PreviewFooter = ({selectedIndex: number;}) => {const { i18n, t } = useTranslation();- const positionLabel = isLoadingBoard- ? t('widgets.preview.loadingBoard')- : selectedIndex === -1- ? t('widgets.preview.itemCount', { count: boardItemCount })- : t('common.countOfTotal', { count: selectedIndex + 1, total: boardItemCount });+ const positionLabel =+ media.kind === 'live'+ ? t('common.generating')+ : isLoadingBoard+ ? t('widgets.preview.loadingBoard')+ : selectedIndex === -1+ ? t('widgets.preview.itemCount', { count: boardItemCount })+ : t('common.countOfTotal', { count: selectedIndex + 1, total: boardItemCount });const item = media.kind === 'item' ? media.item : null;const fps =item?.kind === 'video' && item.fps !== undefined@@ -131,26 +134,28 @@ export const PreviewFooter = ({: ''}</Text></HStack>- <HStack flexShrink={0} gap="1">- <Button- aria-label={t('widgets.preview.previousItemInBoard')}- disabled={selectedIndex <= 0}- size="2xs"- variant="outline"- onClick={onPrevious}- >- <ChevronLeftIcon />- </Button>- <Button- aria-label={t('widgets.preview.nextItemInBoard')}- disabled={selectedIndex === -1 || selectedIndex >= boardItemCount - 1}- size="2xs"- variant="outline"- onClick={onNext}- >- <ChevronRightIcon />- </Button>- </HStack>+ {media.kind === 'item' ? (+ <HStack flexShrink={0} gap="1">+ <Button+ aria-label={t('widgets.preview.previousItemInBoard')}+ disabled={selectedIndex <= 0}+ size="2xs"+ variant="outline"+ onClick={onPrevious}+ >+ <ChevronLeftIcon />+ </Button>+ <Button+ aria-label={t('widgets.preview.nextItemInBoard')}+ disabled={selectedIndex === -1 || selectedIndex >= boardItemCount - 1}+ size="2xs"+ variant="outline"+ onClick={onNext}+ >+ <ChevronRightIcon />+ </Button>+ </HStack>+ ) : null}</HStack>{media.kind === 'item' ? (<PreviewMetadataPaneldiff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsxindex 7d053ec776..a3ceb6e4c1 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx@@ -268,7 +268,7 @@ await i18n.use(initReactI18next).init({resources: {en: {translation: {- common: { countOfTotal: '{{count}} of {{total}}' },+ common: { countOfTotal: '{{count}} of {{total}}', generating: 'Generating' },widgets: {preview: {framesPerSecond: '{{count}} fps',@@ -1490,13 +1490,11 @@ describe('preview keyboard navigation boundary', () => {await render();- // The footer island is up during the live render, fed by queue data: the- // slot's requested output size, and working prev/next.+ // Live status reports the requested size without suggesting board navigation.expect(host?.textContent).toContain('64 × 64');- expect(host?.querySelector('button[aria-label="Next item in board"]')).not.toBeNull();- // No progress badge over the frame — the image is styled exactly like a- // finished item, so completion changes pixels, not chrome.- expect(host?.textContent).not.toContain('Generating');+ expect(host?.querySelector('button[aria-label="Next item in board"]')).toBeNull();+ expect(host?.textContent).toContain('Generating');+ expect(host?.textContent).not.toContain('0 items');expect(host?.querySelector<HTMLImageElement>('img[src^="data:image/png"]')).not.toBeNull();});@@ -1656,6 +1654,34 @@ describe('preview keyboard navigation boundary', () => {);});+ it('restores comparison after live activity ends and allows comparison with live preference enabled while idle', async () => {+ const values = mocks.project.widgetInstances.gallery.state.values as Record<string, unknown>;+ values.compareImage = mocks.recentImages[1];+ mocks.project.settings.showProgressImagesInViewer = true;+ await render();+ expect(host!.textContent).toContain('widgets.preview.exitCompare');+ mocks.project.queue.items = [queueItem];+ mocks.runningProgressTargets = [{ queueItemId: queueItem.id, itemIndex: 1 }];+ await rerender();+ expect(host!.textContent).not.toContain('widgets.preview.exitCompare');+ mocks.runningProgressTargets = [];+ mocks.project.queue.items = [];+ await rerender();+ expect(host!.textContent).toContain('widgets.preview.exitCompare');+ });+ it('keeps pinned live controls and footer inside the widget without saved-image arrows or zero count', async () => {+ mocks.project.queue.items = [queueItem];+ mocks.project.settings.showProgressImagesInViewer = true;+ mocks.runningProgressTargets = [{ queueItemId: queueItem.id, itemIndex: 1 }];+ await render();+ await act(() => followControls.pin('queue-item-live:1'));+ const boundary = host!.querySelector<HTMLElement>('[role="region"]')!;+ expect(boundary.getBoundingClientRect().bottom).toBeLessThanOrEqual(host!.getBoundingClientRect().bottom);+ expect(host!.querySelector('button[aria-label="Next item in board"]')).toBeNull();+ expect(host!.querySelector('button[aria-label="Previous item in board"]')).toBeNull();+ expect(host!.textContent).not.toContain('0 items');+ expect(host!.textContent).toContain('Generating');+ });it('does not consume arrow keys in comparison mode', async () => {(mocks.project.widgetInstances.gallery.state.values as Record<string, unknown>).compareImage = {...mocks.project.widgetInstances.gallery.state.values.recentImages[1],diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsxindex 8e241b3ff1..b00370e816 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx@@ -213,11 +213,6 @@ export const PreviewWidgetView = ({ region, runtime }: WidgetViewProps) => {[galleryValues.semanticImageQuery]);const selectedItemKey = selectedItem ? toGalleryItemKey(selectedItem) : null;- const isComparing =- !showProgressImagesInViewer &&- selectedItem?.kind === 'image' &&- compareImage !== null &&- toGalleryItemKey({ kind: 'image', name: compareImage.imageName }) !== selectedItemKey;const liveGalleryPlaceholders = useMemo(() => livePreview.sessions.filter((session) => session.state === 'running'),[livePreview.sessions]@@ -225,6 +220,11 @@ export const PreviewWidgetView = ({ region, runtime }: WidgetViewProps) => {const pinnedSession = livePreview.sessions.find((session) => session.id === livePreview.pinnedSessionId);const activeGalleryPlaceholder = pinnedSession ?? liveGalleryPlaceholders[0] ?? livePreview.sessions[0] ?? null;const shouldFollowLive = showProgressImagesInViewer && activeGalleryPlaceholder !== null;+ const isComparing =+ !shouldFollowLive &&+ selectedItem?.kind === 'image' &&+ compareImage !== null &&+ toGalleryItemKey({ kind: 'image', name: compareImage.imageName }) !== selectedItemKey;const { t } = useTranslation();const navigationBoundaryRef = useRef<HTMLDivElement | null>(null);const overviewButtonRef = useCallback((element: HTMLButtonElement | null) => {@@ -582,11 +582,6 @@ export const PreviewWidgetView = ({ region, runtime }: WidgetViewProps) => {{/* Single always-mounted keyboard boundary: DOM focus survives swapsbetween the live, selected, and compare branches, so arrownavigation keeps working across them. */}- {shouldFollowLive && pinnedSession ? (- <Button ref={overviewButtonRef} alignSelf="start" size="2xs" variant="ghost" onClick={livePreview.showAll}>- {t('widgets.preview.showAllActivePreviews')}- </Button>- ) : null}<Stackref={navigationBoundaryRef}aria-label={t('widgets.labels.preview')}@@ -599,6 +594,18 @@ export const PreviewWidgetView = ({ region, runtime }: WidgetViewProps) => {w="full"onKeyDown={handleNavigationKeyDown}>+ {shouldFollowLive && pinnedSession ? (+ <Button+ ref={overviewButtonRef}+ alignSelf="start"+ flexShrink={0}+ size="2xs"+ variant="ghost"+ onClick={livePreview.showAll}+ >+ {t('widgets.preview.showAllActivePreviews')}+ </Button>+ ) : null}{shouldFollowLive && !pinnedSession && liveGalleryPlaceholders.length > 1 ? (<LivePreviewTilesplaceholders={liveGalleryPlaceholders}@@ -897,8 +904,8 @@ const SelectedMediaPreview = ({* The single-session live preview: the denoise stream rendered exactly like a* finished item — same scaffold, same frame chrome, no badge — so the moment* generation completes, only the pixels change. The footer stays up- * throughout, fed by queue data: the slot's position in the same navigation- * sequence the arrow keys walk, and its requested output size.+ * throughout, showing generation status and requested output dimensions.+ * Saved-image navigation remains in the filmstrip.*/const LivePreview = ({boardItemCount,