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(gallery): pin the Uncategorized board to the top of the boards panel
Josh Corbett0745b2a6bc89
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.test.ts b/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.test.tsindex 753ab804d1..2c1f5bb010 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.test.ts+++ b/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.test.ts@@ -40,14 +40,14 @@ describe('getGalleryBoardGroups', () => {it('splits archived boards into their own section instead of the main list', () => {const groups = groupsOf();- expect(groups.yourBoards.map((board) => board.id)).toEqual(['dogs', 'cats', 'other', 'mine', 'none']);+ expect(groups.yourBoards.map((board) => board.id)).toEqual(['none', 'dogs', 'cats', 'other', 'mine']);expect(groups.archivedBoards.map((board) => board.id)).toEqual(['gorl']);});- it('puts Uncategorized last and hoists the project board first', () => {+ it('pins Uncategorized first, then the hoisted project board, then other boards', () => {const groups = groupsOf({ projectBoardId: 'cats' });- expect(groups.yourBoards.map((board) => board.id)).toEqual(['cats', 'dogs', 'other', 'mine', 'none']);+ expect(groups.yourBoards.map((board) => board.id)).toEqual(['none', 'cats', 'dogs', 'other', 'mine']);});it('hides the date and archived sections when their toggles are off', () => {@@ -55,19 +55,19 @@ describe('getGalleryBoardGroups', () => {expect(groups.archivedBoards).toEqual([]);expect(groups.dateBoards).toEqual([]);- expect(groups.yourBoards.map((board) => board.id)).toEqual(['dogs', 'cats', 'other', 'mine', 'none']);+ expect(groups.yourBoards.map((board) => board.id)).toEqual(['none', 'dogs', 'cats', 'other', 'mine']);});it('drops boards owned by another project when they are hidden', () => {const groups = groupsOf({ showOtherProjects: false });- expect(groups.yourBoards.map((board) => board.id)).toEqual(['dogs', 'cats', 'none']);+ expect(groups.yourBoards.map((board) => board.id)).toEqual(['none', 'dogs', 'cats']);});it('keeps the open project own board even while other projects are hidden', () => {const groups = groupsOf({ projectBoardId: 'mine', showOtherProjects: false });- expect(groups.yourBoards.map((board) => board.id)).toEqual(['mine', 'dogs', 'cats', 'none']);+ expect(groups.yourBoards.map((board) => board.id)).toEqual(['none', 'mine', 'dogs', 'cats']);});it('filters every section by a case-insensitive substring match', () => {@@ -80,7 +80,7 @@ describe('getGalleryBoardGroups', () => {});it('matches anywhere in the name, so Uncategorized answers to "cat"', () => {- expect(groupsOf({ searchTerm: 'cat' }).yourBoards.map((board) => board.id)).toEqual(['cats', 'none']);+ expect(groupsOf({ searchTerm: 'cat' }).yourBoards.map((board) => board.id)).toEqual(['none', 'cats']);});it('offers to create only when the search names no existing board', () => {diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts b/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.tsindex 8be176f476..57fba20c1f 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts+++ b/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts@@ -10,7 +10,7 @@ export interface GalleryBoardGroups {dateBoards: GalleryBoard[];/** Any row at all survived the search — drives the "no matches" copy. */hasAnyMatch: boolean;- /** Project board (if any), then other boards, then Uncategorized last. */+ /** Uncategorized first, then the project board (if any), then other boards. */yourBoards: GalleryBoard[];}@@ -64,10 +64,14 @@ export const getGalleryBoardGroups = ({const dateBoards = showDates ? boards.filter((board) => board.kind === 'date' && matchesBoardSearch(board)) : [];const archivedBoards = showArchived ? regularBoards.filter((board) => board.archived) : [];+ // Uncategorized is the one fixed system row, so it keeps a fixed seat at+ // the top — as the legacy gallery pinned it — instead of drifting further+ // down as boards accumulate. The pin holds during a search too: rows keep+ // their familiar slots under a quick filter.const yourBoards = [+ ...(uncategorizedBoard && matchesBoardSearch(uncategorizedBoard) ? [uncategorizedBoard] : []),...(projectBoard && matchesBoardSearch(projectBoard) ? [projectBoard] : []),...regularBoards.filter((board) => !board.archived),- ...(uncategorizedBoard && matchesBoardSearch(uncategorizedBoard) ? [uncategorizedBoard] : []),];const hasAnyMatch = yourBoards.length > 0 || dateBoards.length > 0 || archivedBoards.length > 0;