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): anchor strip selections at the top of the starred listing
Josh Corbett5bd10ba0fad1
diff --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 a6574a308b..ccac719084 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@@ -499,6 +499,34 @@ describe('preview keyboard navigation boundary', () => {expect(mocks.galleryItemFilters.every((query) => query.starred === true)).toBe(true);});+ it('anchors a strip selection at the top of the starred listing, not at the grid page it was stamped with', async () => {+ // Paginated mode, grid on page 2: the stamp says page 2 of the unstarred+ // listing, but the clicked strip item sits at the top of the starred one.+ const starredItem = { ...createImageItem('starred-top', '2026-07-23T00:00:00.000Z'), starred: true };+ const starredNext = { ...createImageItem('starred-next', '2026-07-22T00:00:00.000Z'), starred: true };++ setGalleryValues({+ galleryPage: 2,+ paginationMode: 'paginated',+ recentImages: [],+ selectedImage: { ...legacyImage('starred-top', '2026-07-23T00:00:00.000Z'), starred: true },+ selectedImageName: 'starred-top',+ selectedImageQuery: { ...deepQuery, page: 2, paginationMode: 'paginated' },+ });+ mocks.galleryItemPages = [{ items: [starredItem, starredNext], total: 2 }];++ await render();+ await pressArrow('ArrowRight');++ expect(mocks.galleryItemWindowOffsets.every((offset) => offset === 0)).toBe(true);+ expect(mocks.commands.gallery.selectItem).toHaveBeenCalledWith(+ expect.objectContaining({ name: 'starred-next' }),+ undefined,+ expect.any(Number),+ true+ );+ });+it('handles one arrow press as exactly one selection and stops propagation', async () => {const documentKeydown = vi.fn();document.addEventListener('keydown', documentKeydown);diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts b/invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.tsindex d32771c565..c872b6f758 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts@@ -234,8 +234,12 @@ export const usePreviewNavigation = ({// Held sticky, the anchor outlived every one of them: a click on the newest// image at the top of the board left Preview walking rows 1800+ for a// selection at row 0.- const navigationAnchorPage =- selectedImageQuery.paginationMode === 'paginated'+ // A strip selection is stamped with the grid's page, which indexes the+ // unstarred listing; the strip is the top of the starred one.+ const isStripSelection = navigationStarredOnly && !selectedImageQuery.starredOnly;+ const navigationAnchorPage = isStripSelection+ ? 0+ : selectedImageQuery.paginationMode === 'paginated'? hasStaleNavigationAnchor? selectedImageQuery.page: navigationAnchor.page