Skip to content

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.

Merge branch 'main' into fix/preview-navigation-follows-gallery-order

Lincoln Stein0d2d10c85462
diff --cc invokeai/frontend/webv2/src/features/gallery/contracts.ts
index ca29f42001,e9ae782497..f626b63d48
--- a/invokeai/frontend/webv2/src/features/gallery/contracts.ts
+++ b/invokeai/frontend/webv2/src/features/gallery/contracts.ts
@@@ -34,7 -34,12 +34,13 @@@ export
type GalleryVideoItem,
} from './core/items';
export { GALLERY_RECENT_IMAGE_LIMIT, getBoundedRecentImages } from './core/recentImages';
- export { gallerySemanticReferenceKey, type GallerySemanticReference } from './core/semanticImageQuery';
+ export {
++ gallerySemanticReferenceKey,
+ getImageCluster,
+ parseGallerySemanticReference,
+ registerImageCluster,
+ type GallerySemanticReference,
+ } from './core/semanticImageQuery';
export {
DEFAULT_GALLERY_SETTINGS,
getGallerySettings,
diff --cc invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts
index a095da4066,6a5109b1ab..e655927a90
--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts
@@@ -219,22 -186,6 +219,33 @@@ export const usePreviewNavigation = (
const navigationAnchorPage = hasStaleNavigationAnchor ? selectedImageQuery.page : navigationAnchor.page;
+ // A ranked list mirrors the GRID's paging instead of the stamped context.
+ // The stamped page indexes the board listing, and a board page applied to a
+ // ranking lands on an unrelated slice — or, past the end of a ranking that is
+ // shorter than the board, on an empty one whose only member is the anchored
+ // selection, leaving both arrows with nowhere to step. Setting a search also
+ // resets the grid's page, which the stamped record never sees.
+ const navigationWindow = shouldFollowLive
+ ? ({ kind: 'infinite' } as const)
+ : navigationSemanticQuery !== null
+ ? galleryPaginationMode === 'paginated'
+ ? ({ kind: 'anchor', offset: galleryPage * GALLERY_PAGE_SIZE } as const)
- : ({ kind: 'infinite' } as const)
++ : // In infinite mode the grid's page IS its window offset, so mirroring
++ // it covers the deep-reveal case below without a separate test.
++ ({ kind: 'infinite', offset: galleryPage * GALLERY_PAGE_SIZE } as const)
+ : selectedImageQuery.paginationMode === 'paginated'
+ ? ({ kind: 'anchor', offset: navigationAnchorPage * GALLERY_PAGE_SIZE } as const)
- : ({ kind: 'infinite' } as const);
++ : ({
++ kind: 'infinite',
++ // A selection deeper than the base window's reach (a deep reveal
++ // from the image map) anchors navigation at its own page —
++ // walking from offset 0 could never arrive at the cursor.
++ offset:
++ navigationAnchorPage * GALLERY_PAGE_SIZE >= GALLERY_MAX_ROWS
++ ? navigationAnchorPage * GALLERY_PAGE_SIZE
++ : 0,
++ } as const);
+
const {
data: boardItemsData,
fetchNextPage: fetchNextBoardItemsPage,