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.

fix(gallery): keep the paging constants transport-free

Josh Corbettac41c144c0ce
diff --git a/invokeai/frontend/webv2/src/features/gallery/core/paging.ts b/invokeai/frontend/webv2/src/features/gallery/core/paging.ts
new file mode 100644
index 0000000000..7a4a56e2eb
--- /dev/null
+++ b/invokeai/frontend/webv2/src/features/gallery/core/paging.ts
@@ -0,0 +1,4 @@
+/** Listing page geometry, transport-free so pure views can read it. */
+export const GALLERY_PAGE_SIZE = 60;
+export const GALLERY_MAX_INFINITE_PAGES = 10;
+export const GALLERY_MAX_ROWS = GALLERY_PAGE_SIZE * GALLERY_MAX_INFINITE_PAGES;
diff --git a/invokeai/frontend/webv2/src/features/gallery/data/queries.ts b/invokeai/frontend/webv2/src/features/gallery/data/queries.ts
index 05a3f31554..0c6458d9b9 100644
--- a/invokeai/frontend/webv2/src/features/gallery/data/queries.ts
+++ b/invokeai/frontend/webv2/src/features/gallery/data/queries.ts
@@ -4,6 +4,7 @@ import type { GalleryBoardOrderBy, GalleryOrderDir, GalleryView } from '@feature
import type { AccountScope } from '@platform/state/accountLifecycle';
import { toGalleryItemKey } from '@features/gallery/core/items';
+import { GALLERY_MAX_INFINITE_PAGES, GALLERY_MAX_ROWS, GALLERY_PAGE_SIZE } from '@features/gallery/core/paging';
import { toGallerySemanticQuery } from '@features/gallery/core/semanticImageQuery';
import { assertAccountScopeCurrent, captureAccountScope } from '@platform/state/accountLifecycle';
import {
@@ -27,9 +28,7 @@ import {
listSemanticGalleryItemNames,
} from './backend';
-export const GALLERY_PAGE_SIZE = 60;
-export const GALLERY_MAX_INFINITE_PAGES = 10;
-export const GALLERY_MAX_ROWS = GALLERY_PAGE_SIZE * GALLERY_MAX_INFINITE_PAGES;
+export { GALLERY_MAX_INFINITE_PAGES, GALLERY_MAX_ROWS, GALLERY_PAGE_SIZE };
export interface GalleryBoardsQuery {
includeArchived?: boolean;
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts b/invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts
index 6a0003a8a6..04f3a985a3 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts
@@ -7,6 +7,7 @@ import {
type GalleryItem,
type GalleryItemKey,
} from '@features/gallery/core/items';
+import { GALLERY_PAGE_SIZE } from '@features/gallery/core/paging';
import { getBoundedRecentImages } from '@features/gallery/core/recentImages';
import {
getPersistedSelectedGalleryItemKeys,
@@ -18,7 +19,6 @@ import {
type GallerySemanticReference,
} from '@features/gallery/core/semanticImageQuery';
import { getGallerySettings, type GallerySettings } from '@features/gallery/core/settings';
-import { GALLERY_PAGE_SIZE } from '@features/gallery/data/queries';
import { getQueueItemSnapshotBatchCount, getQueueItemSnapshotDimensions } from '@features/queue/contracts';
/**