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 feat/tweaks-fixes-compendium-03

Josh Corbett1a9145ee2e9c
diff --cc invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx
index 4031c3ed9a,865f87ecbd..891e367e64
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx
@@@ -246,58 -186,32 +246,60 @@@ export const GalleryImageGrid = () =>
// The listing is unstarred-only, so a board whose items are all starred
// still has the strip to show.
const isEmpty = gallery.items.length === 0 && starredStrip.items.length === 0;
- const hasActiveSearch = gallery.searchTerm.trim() !== '';
+ // A ranking that matched nothing is still a search result, never an empty
+ // board inviting an upload.
+ const hasActiveSearch = gallery.searchTerm.trim() !== '' || gallery.semanticImageQuery !== null;
const isVirtualBoard = isDateBoardId(gallery.selectedBoardId);
- const rows = useMemo(
- () =>
- buildGalleryGridRows({
- columnCount,
- isStarredOpen,
- items: gallery.items,
- starredItems: starredStrip.items,
- starredTotal: starredStrip.total,
- }),
- [columnCount, gallery.items, isStarredOpen, starredStrip.items, starredStrip.total]
- );
- const navigation = useMemo(
- () =>
- buildGalleryGridNavigation({
- columnCount,
- isStarredOpen,
- items: gallery.items,
- starredItems: starredStrip.items,
- }),
- [columnCount, gallery.items, isStarredOpen, starredStrip.items]
+ const rows = useMemo(() => buildGalleryGridRows(gallery.items, columnCount), [columnCount, gallery.items]);
+ const starredCells = useMemo(
+ () => getGalleryStarredStripItems(starredStrip.items, columnCount),
+ [columnCount, starredStrip.items]
);
+ // The arrow keys' sections in visual order; a collapsed section has no
+ // tiles to land on, so it contributes none. A starred selection the strip
+ // does not show (beyond its three rows, or under a collapsed disclosure)
+ // still belongs to the strip section, so the keys step out of it instead
+ // of resetting — Preview places such a selection the same way.
+ const isProgressOpen = showPendingItems && !progressSectionCollapsed;
+ const navigationSections = useMemo((): GalleryNavigationEntry[][] => {
+ const shownStripItems = isStarredOpen ? starredCells : [];
+ const selectedKey = gallery.selectedItemKey;
+ const isSelected = (item: GalleryItem) => toGalleryItemKey(item) === selectedKey;
+ const hiddenStripSelection =
+ selectedKey !== null && !shownStripItems.some(isSelected) && !gallery.items.some(isSelected)
+ ? starredStrip.items.find(isSelected)
+ : undefined;
+ const stripEntries: GalleryNavigationEntry[] = shownStripItems.map((item) => ({ item, kind: 'item' }));
+
+ if (hiddenStripSelection) {
+ stripEntries.push({ item: hiddenStripSelection, kind: 'item' });
+ }
+
+ return [
+ isProgressOpen
+ ? progressSessions.map((session) => ({
+ id: session.id,
+ kind: 'session',
+ navigable: session.state === 'running',
+ }))
+ : [],
+ stripEntries,
+ gallery.items.map((item) => ({ item, kind: 'item' })),
+ ];
+ }, [
+ gallery.items,
+ gallery.selectedItemKey,
+ isProgressOpen,
+ isStarredOpen,
+ progressSessions,
+ starredCells,
+ starredStrip.items,
+ ]);
+ const cursorKey =
+ followedProgressSessionId !== null
+ ? getGallerySessionNavigationKey(followedProgressSessionId)
+ : gallery.selectedItemKey;
const rowCount = rows.length;
const cellSizePx = getGalleryCellSizePx({ columnCount, widthPx: viewportWidth });