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): offer only board moves the server accepts and recheck boards on every project load
Josh Corbette6811416dcf4
diff --git a/docs/src/content/docs/Users Guide/06.Gallery/gallery-reference.mdx b/docs/src/content/docs/Users Guide/06.Gallery/gallery-reference.mdxindex a15ccacef4..8d954d225e 100644--- a/docs/src/content/docs/Users Guide/06.Gallery/gallery-reference.mdx+++ b/docs/src/content/docs/Users Guide/06.Gallery/gallery-reference.mdx@@ -25,7 +25,7 @@ Hover over a board and click its **⋮** button, or right-click it, to open its* **Auto-add to this board** — makes this the board that receives new results, marked **Auto**, whichever board is selected. On the auto-add board, the item is **Stop auto-adding here**, which goes back to sending results to the selected board. Not offered for date boards or archived boards. See [Choosing where new media goes](/users-guide/gallery/introduction/#choosing-where-new-media-goes).* **Download Board** — downloads the board (see [below](#downloading-a-board)).* **Rename board** — opens a dialog to change the name.-* **Move to…** — moves the board to the **Library**, into the open project, or into one of your other projects. A board in a project is private to you. You can also drag the board onto another group: the open project's, the **Library**, or one of the projects under **Other projects**. When the board's new project is hidden because **Other projects' boards** is off: if it was the selected board, the Gallery selects **Uncategorized**; if it was the auto-add board, results follow the selected board again.+* **Move to…** — moves the board to the **Library**, into the open project, or into one of your other projects. A board in a project is private to you, so this is offered only for your own private boards: a shared or public board stays in the **Library**, and an administrator cannot move another person's boards. You can also drag the board onto another group: the open project's, the **Library**, or one of your projects under **Other projects**. When the board's new project is hidden because **Other projects' boards** is off: if it was the selected board, the Gallery selects **Uncategorized**; if it was the auto-add board, results follow the selected board again.* **Archive Board** / **Unarchive Board** — see [below](#archiving-a-board).* **Delete Board** — see [below](#deleting-a-board).diff --git a/invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx b/invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsxindex 1400343204..7f6469b0ec 100644--- a/invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx+++ b/invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx@@ -4,6 +4,7 @@ import type { ProjectLibrarySnapshot } from '@workbench/projects/library';import type { ReactNode } from 'react';import { GalleryUiProvider } from '@features/gallery/react';+import { useAuthSession } from '@features/identity';import { useMountEffect } from '@platform/react/useMountEffect';import { captureAccountScope, isAccountScopeCurrent } from '@platform/state/accountLifecycle';import { useProjectLibrarySelector } from '@workbench/projects/library';@@ -60,6 +61,8 @@ export const GalleryUiAdapterProvider = ({ children }: { children: ReactNode })const accountScope = captureAccountScope();const exportProject = useExportLibraryProject();const openWorkbenchWidget = useOpenWorkbenchWidget();+ const session = useAuthSession();+ const currentUserId = session.multiuserEnabled ? (session.user?.user_id ?? null) : null;// Only what the gallery needs to label other projects' boards, compared structurally: every autosave ack and// library refresh rebuilds the summaries, and the gallery must not re-render for cover or timestamp churn.const projects = useProjectLibrarySelector(selectGalleryProjects, areGalleryProjectsEqual);@@ -72,6 +75,7 @@ export const GalleryUiAdapterProvider = ({ children }: { children: ReactNode })const adapter = useMemo<GalleryUiAdapter>(() => ({antialiasProgressImages,+ currentUserId,exportProject,gallery: {...gallery,@@ -130,6 +134,7 @@ export const GalleryUiAdapterProvider = ({ children }: { children: ReactNode })[accountScope,antialiasProgressImages,+ currentUserId,exportProject,gallery,galleryValues,diff --git a/invokeai/frontend/webv2/src/features/gallery/core/types.ts b/invokeai/frontend/webv2/src/features/gallery/core/types.tsindex 5561fb32e1..c934ea9341 100644--- a/invokeai/frontend/webv2/src/features/gallery/core/types.ts+++ b/invokeai/frontend/webv2/src/features/gallery/core/types.ts@@ -64,6 +64,8 @@ export interface GalleryBoard {coverThumbnailUrl?: string;/** ISO creation timestamp; absent for uncategorized and date virtual boards. */createdAt?: string | null;+ /** The owner's user id; a project only ever holds its owner's boards. */+ ownerId?: string;ownerName?: string | null;/*** The project this board belongs to; null is the Library. Members are ordinary boards; only the inbox is@@ -72,6 +74,8 @@ export interface GalleryBoard {projectId: string | null;/** Its project's inbox: named after the project and only renamed, archived, moved or deleted through it. */isInbox: boolean;+ /** Who besides its owner can see it; only a private board can join a project. Absent reads as private. */+ visibility?: 'private' | 'shared' | 'public';}export interface GalleryImage extends GeneratedImageContract {diff --git a/invokeai/frontend/webv2/src/features/gallery/data/backend.ts b/invokeai/frontend/webv2/src/features/gallery/data/backend.tsindex ce082f7f7a..8df401ff53 100644--- a/invokeai/frontend/webv2/src/features/gallery/data/backend.ts+++ b/invokeai/frontend/webv2/src/features/gallery/data/backend.ts@@ -56,6 +56,8 @@ interface BackendBoardDTO {created_at?: string | null;/** Board owner's display name; populated only for admins on multi-user backends. */owner_username?: string | null;+ user_id?: string;+ board_visibility?: 'private' | 'shared' | 'public';/** The project this board belongs to; absent or null for a Library board. */project_id?: string | null;/** Its project's inbox, which only the project routes may rename, archive, move or delete. */@@ -183,8 +185,10 @@ const mapBoard = (board: BackendBoardDTO): GalleryBoard => ({isInbox: board.is_inbox ?? false,kind: 'board',name: board.board_name,+ ownerId: board.user_id,ownerName: board.owner_username ?? null,projectId: board.project_id ?? null,+ visibility: board.board_visibility,videoCount: board.video_count ?? 0,});diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.browser.test.tsxindex e637f105bd..1b3ebf37b3 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.browser.test.tsx@@ -66,6 +66,8 @@ const context = {projectBoardId: null,settings: { autoAddBoardId: 'follow' },},+ // Signed in, as an admin can be, alongside boards that are not theirs.+ currentUserId: 'me',projectId: 'p1',projectName: 'Mahogany House',projectNames: new Map([@@ -153,11 +155,11 @@ it('hands results back to the selected board from the auto-add board itself', asexpect(context.actions.updateSettings).toHaveBeenLastCalledWith({ autoAddBoardId: 'follow' });});-const renderMenuFor = async (menuBoard: GalleryBoard) => {+const renderMenuFor = async (menuBoard: GalleryBoard, overrides: Partial<GalleryWidgetContextValue> = {}) => {await act(async () => {root?.render(<ChakraProvider value={system}>- <GalleryWidgetContext value={context}>+ <GalleryWidgetContext value={{ ...context, ...overrides }}><GalleryBoardMenu target={{ board: menuBoard, x: 20, y: 20 }} onClose={noop} /></GalleryWidgetContext></ChakraProvider>@@ -209,6 +211,24 @@ it('offers a Library board the open project first', async () => {).toEqual(['Mahogany House', 'Harbor Tower']);});+it.each([+ ['someone else’s board, which only its owner can move into their projects', { ownerId: 'them' }],+ ['a shared or public board, which stays in the Library', { ownerId: 'me', visibility: 'shared' as const }],+])('offers no move for %s, while keeping the rest of its menu', async (_label, overrides) => {+ await renderMenuFor({ ...board, ...overrides } as GalleryBoard);++ const labels = menuItemLabels();++ expect(labels).not.toContain('Move to…');+ expect(labels).toContain('widgets.gallery.renameBoard');+});++it('offers the move on a single-user install, where every board is the one user’s whatever owner it records', async () => {+ await renderMenuFor({ ...board, ownerId: 'system' } as GalleryBoard, { currentUserId: null });++ expect(menuItemLabels()).toContain('Move to…');+});+it('leaves an inbox with only the actions its project does not own', async () => {await renderMenuFor({ ...board, isInbox: true, projectId: 'p1' } as GalleryBoard);diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsxindex a29382d2bd..30d44ea18c 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx@@ -20,7 +20,7 @@ import {import { useCallback, useMemo, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';-import { isManagedGalleryBoard } from './galleryBoardGroups';+import { canMoveGalleryBoard, isManagedGalleryBoard } from './galleryBoardGroups';import { useGalleryWidget } from './GalleryWidgetContext';export interface GalleryBoardMenuTarget {@@ -41,7 +41,7 @@ export const GalleryBoardMenu = ({onClose: () => void;}) => {const { t } = useTranslation();- const { actions, gallery } = useGalleryWidget();+ const { actions, currentUserId, gallery } = useGalleryWidget();const [renameTarget, setRenameTarget] = useState<GalleryBoard | null>(null);const [deleteTarget, setDeleteTarget] = useState<GalleryBoard | null>(null);const [renameValue, setRenameValue] = useState('');@@ -157,7 +157,9 @@ export const GalleryBoardMenu = ({{isManagedBoard && (<><BoardRenameMenuItem board={board} onRename={setRenameTarget} onRenameValue={setRenameValue} />- <BoardMoveSubMenu board={board} onBoardMoved={onBoardRelocated} />+ {canMoveGalleryBoard(board, gallery.projectBoardId, currentUserId) && (+ <BoardMoveSubMenu board={board} onBoardMoved={onBoardRelocated} />+ )}<BoardArchiveMenuItem archived={board.archived} boardId={board.id} onArchive={onBoardRelocated} /><Menu.Separator /><BoardDeleteMenuItem board={board} onDelete={setDeleteTarget} />diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsxindex 10ac097187..f38f3c0e8b 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsx@@ -122,10 +122,14 @@ const WorkbenchDrag = ({ children }: { children: ReactNode }) => {);};-const renderPanel = async (gallery: GalleryStateView = createGallery(), { withDrag = false } = {}) => {+const renderPanel = async (+ gallery: GalleryStateView = createGallery(),+ { currentUserId = null, withDrag = false }: { currentUserId?: string | null; withDrag?: boolean } = {}+) => {const contextValue = {actions,boardsState: { error: null, isRetrying: false, retry: () => Promise.resolve(), status: 'ready' },+ currentUserId,gallery,itemActions,projectId: 'p1',@@ -442,6 +446,31 @@ describe('GalleryBoardsPanel', () => {expect(actions.moveBoard).not.toHaveBeenCalled();});+ it('drags only boards the server would move, and only onto the caller’s own projects', async () => {+ // An admin sees other people's boards and projects; a shared board of their own stays in the Library.+ await renderPanel(+ {+ ...createGallery({ showOtherProjectBoards: true }),+ boards: boards.map((board) =>+ board.projectId === 'p2' || board.id === 'cats'+ ? { ...board, ownerId: 'them' }+ : board.id === 'dogs'+ ? { ...board, ownerId: 'me', visibility: 'shared' as const }+ : { ...board, ownerId: 'me' }+ ),+ } as GalleryStateView,+ { currentUserId: 'me', withDrag: true }+ );++ await drag(row('Cats'), heading('Mahogany House'));+ await drag(row('dogs'), heading('Mahogany House'));+ await drag(row('Façades'), heading('Harbor Tower'));+ expect(actions.moveBoard).not.toHaveBeenCalled();++ await drag(row('Façades'), heading('Library'));+ expect(actions.moveBoard).toHaveBeenCalledExactlyOnceWith('mine-member', null, 'Library');+ });+it('takes a drop on a collapsed tier, by its heading', async () => {await renderPanel(createGallery({ collapsedBoardSections: ['library'] }), { withDrag: true });diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsxindex b9dd99f694..85988c4d29 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';import { BoardCoverIcon } from './GalleryBoardCover';import { GalleryBoardFilters } from './GalleryBoardFilters';-import { getGalleryBoardGroups, isManagedGalleryBoard } from './galleryBoardGroups';+import { canMoveGalleryBoard, getGalleryBoardGroups, isOwnGalleryBoard } from './galleryBoardGroups';import { GalleryBoardMenu, type GalleryBoardMenuTarget } from './GalleryBoardMenu';import { GalleryBoardRow } from './GalleryBoardRow';import { GalleryBoardRowShell } from './GalleryBoardRowShell';@@ -37,7 +37,8 @@ type CreateTier = 'library' | 'project';export const GalleryBoardsPanel = () => {const { t } = useTranslation();- const { actions, boardsState, gallery, projectId, projectName, projectNames, region } = useGalleryWidget();+ const { actions, boardsState, currentUserId, gallery, projectId, projectName, projectNames, region } =+ useGalleryWidget();// Boards move between tiers by dragging only inside the workbench's drag context; elsewhere, by their menu.const canDragBoards = use(GalleryDragScope);const [searchTerm, setSearchTerm] = useState('');@@ -204,7 +205,9 @@ export const GalleryBoardsPanel = () => {key={board.id}accessibleName={accessibleName}board={board}- dragScope={canDragBoards && isManagedGalleryBoard(board, gallery.projectBoardId) ? region : undefined}+ dragScope={+ canDragBoards && canMoveGalleryBoard(board, gallery.projectBoardId, currentUserId) ? region : undefined+ }isAutoAddTarget={board.id === gallery.settings.autoAddBoardId}isMenuOpen={boardMenuTarget?.board.id === board.id}isSelected={board.id === gallery.selectedBoardId}@@ -224,9 +227,10 @@ export const GalleryBoardsPanel = () => {onSelect={tier === 'project' ? createProjectBoardFromSearch : createLibraryBoardFromSearch}/>) : null;- // A dragged board moves to whichever tier it is dropped on.- const renderDropTier = (tierProjectId: string | null, label: string, content: ReactNode) =>- canDragBoards ? (+ // A dragged board moves to whichever tier it is dropped on, so long as the tier is the caller's: an admin also sees+ // other people's projects, which only their owners' boards can join.+ const renderDropTier = (tierProjectId: string | null, label: string, content: ReactNode, isOwnTier = true) =>+ canDragBoards && isOwnTier ? (<GalleryBoardTierDropZone dropScope={region} label={label} projectId={tierProjectId}>{content}</GalleryBoardTierDropZone>@@ -338,7 +342,8 @@ export const GalleryBoardsPanel = () => {board.isInbox ? t('widgets.gallery.inboxOf', { project: group.label }) : undefined))}- </Stack>+ </Stack>,+ group.boards.every((board) => isOwnGalleryBoard(board, currentUserId)))}</Fragment>))}diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryUiContext.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryUiContext.tsxindex fe1ee3a3ed..442cc675aa 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryUiContext.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryUiContext.tsx@@ -113,6 +113,8 @@ export interface GalleryUiAdapter {/** Resolves an item's best image-map vocabulary label, or null when it has none. */getItemLabel(item: GalleryItemRef): Promise<string | null>;notifications: GalleryNotificationsPort;+ /** The signed-in user, whose boards alone can move into or between their projects; null on a single-user install. */+ currentUserId?: string | null;projectId: string;projectName: string;/** The account's projects, for naming the boards that belong to each; the open project need not be among them. */diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetContext.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetContext.tsxindex f4ab08e0cc..7e48f315cd 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetContext.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetContext.tsx@@ -90,6 +90,8 @@ export interface GalleryWidgetContextValue {/** See `GalleryData.pinRevealIndex`; offered for sparse infinite listings only. */pinRevealIndex?: (absoluteIndex: number) => void;starredStrip: GalleryStarredStrip;+ /** See `GalleryUiAdapter.currentUserId`. */+ currentUserId: string | null;projectId: string;projectName: string;/** Names for the projects other boards belong to, keyed by project id. */diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetView.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetView.tsxindex 66ed2d6ff4..05c27da945 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetView.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetView.tsx@@ -90,6 +90,7 @@ export const useGallerySemanticImageQuery = (value: unknown) =>export const GalleryWidgetView = ({ presentation, region, runtime }: GalleryWidgetProps) => {const {+ currentUserId,gallery: galleryCommands,galleryValues,generateValues,@@ -252,6 +253,7 @@ export const GalleryWidgetView = ({ presentation, region, runtime }: GalleryWidggallery={gallery}isWindowTruncated={data.isWindowTruncated}listing={data.listing}+ currentUserId={currentUserId ?? null}loadedItems={loadedItems}projectId={projectId}projectName={projectName}@@ -300,6 +302,7 @@ const getGalleryFailureAnnouncement = (const GalleryWidgetContent = ({actions,boardsState,+ currentUserId,filter,gallery,isWindowTruncated,@@ -322,6 +325,7 @@ const GalleryWidgetContent = ({isWindowTruncated: boolean;listing: GalleryListingState;loadedItems: GalleryItem[];+ currentUserId: string | null;pinRevealIndex: GalleryData['pinRevealIndex'];projectId: string;projectName: string;@@ -339,6 +343,7 @@ const GalleryWidgetContent = ({() => ({actions,boardsState,+ currentUserId,filter,gallery,isWindowTruncated,@@ -358,6 +363,7 @@ const GalleryWidgetContent = ({[actions,boardsState,+ currentUserId,filter,gallery,isWindowTruncated,diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts b/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.tsindex bb92654c96..fdba9e0461 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts+++ b/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts@@ -38,6 +38,24 @@ export interface GalleryBoardGroups {export const isManagedGalleryBoard = (board: GalleryBoard, projectBoardId: string | null): boolean =>board.kind === 'board' && !board.isInbox && board.id !== projectBoardId;+/** Whether the board is the signed-in user's; on a single-user install (`currentUserId` null), every board is. */+export const isOwnGalleryBoard = (board: GalleryBoard, currentUserId: string | null): boolean =>+ currentUserId === null || board.ownerId === undefined || board.ownerId === currentUserId;++/**+ * Whether the board can move between the Library and projects, by menu or by dragging. Only into its owner's own+ * projects, which are the only ones the caller can name, and only while it is private: a shared or public board stays+ * in the Library. An admin may manage someone else's board, but not move it into a project of theirs.+ */+export const canMoveGalleryBoard = (+ board: GalleryBoard,+ projectBoardId: string | null,+ currentUserId: string | null+): boolean =>+ isManagedGalleryBoard(board, projectBoardId) &&+ isOwnGalleryBoard(board, currentUserId) &&+ (board.visibility ?? 'private') === 'private';+/*** Apply visibility filters while grouping; GET /boards/ cannot filter by project and returns the complete list.* Membership is the board's own `projectId`; `projectBoardId` also claims the open project's inbox, which a draftdiff --git a/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.test.ts b/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.test.tsindex 069dec3238..68823a2cc7 100644--- a/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.test.ts+++ b/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.test.ts@@ -102,6 +102,30 @@ describe('createGalleryBoardReferenceCheck', () => {expect(reconciled(store)).toEqual(['gone', 'also-gone']);});+ it('asks again for a project loaded later, or reopened, rather than trusting an earlier answer', async () => {+ const first = withGallery(createDraftProject([]), { autoAddBoardId: 'shared-board' });+ const later = withGallery(createDraftProject([first]), { selectedBoardId: 'shared-board' });+ const store = createStore([first]);+ let exists = true;+ const boardExists = vi.fn(() => Promise.resolve(exists));++ createGalleryBoardReferenceCheck(store as never, boardExists);+ await settle();+ expect(reconciled(store)).toEqual([]);++ // The board goes, with a project deleted in this session; a project opened afterwards names it.+ exists = false;+ store.set({ projects: [first, later] });+ await settle();+ expect(reconciled(store)).toEqual(['shared-board']);++ // Closed and opened again, the first project is asked about afresh.+ store.set({ projects: [later] });+ store.set({ projects: [later, first] });+ await settle();+ expect(boardExists).toHaveBeenCalledTimes(3);+ });+it('acts on no answer that arrives after the workbench is gone', async () => {const project = withGallery(createDraftProject([]), { selectedBoardId: 'gone' });const store = createStore([project]);diff --git a/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.tsx b/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.tsxindex 0cef435f9f..1de74b967c 100644--- a/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.tsx+++ b/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.tsx@@ -38,7 +38,10 @@ export const WorkbenchRuntime = () => {* Clears what each project loaded into the workbench says about boards that are gone. A board can go while the project* is not open — deleted from another tab, or with a project deleted from the Launchpad — and the project's saved* selection, auto-add board and unfinished queue items would keep naming it, sending results to a board that no longer- * exists. Each project is checked once, as it is loaded, and each board it names is asked about once.+ * exists. Each project is checked as it is loaded, against what the server says then: an earlier answer for the same+ * board may be stale, since it can go with a project or board deleted in between. Only a question still in flight is+ * shared, and a project closed and opened again is checked again. The Launchpad is a route of its own, so returning+ * from it mounts a new workbench, which checks every project it loads.*/export const createGalleryBoardReferenceCheck = (store: Pick<WorkbenchInternalStore, 'commands' | 'getSnapshot' | 'subscribe'>,@@ -48,11 +51,11 @@ export const createGalleryBoardReferenceCheck = (const lifetime = new AbortController();const signal = AbortSignal.any([owner.signal, lifetime.signal]);const checkedProjectIds = new Set<string>();- const askedBoardIds = new Set<string>();+ const unansweredBoardIds = new Set<string>();let checkedProjects: unknown = null;const ask = (boardId: string) => {- askedBoardIds.add(boardId);+ unansweredBoardIds.add(boardId);boardExists(boardId, signal).then((exists) => {if (!exists && !signal.aborted && isAccountScopeCurrent(owner)) {@@ -68,7 +71,8 @@ export const createGalleryBoardReferenceCheck = (}})// Unanswered says nothing about the board; it stays named.- .catch(() => undefined);+ .catch(() => undefined)+ .finally(() => unansweredBoardIds.delete(boardId));};// Every edit notifies; only a change to the set of loaded projects can bring one in to check.@@ -80,6 +84,13 @@ export const createGalleryBoardReferenceCheck = (}checkedProjects = projects;+ const loadedProjectIds = new Set(projects.map((project) => project.id));++ for (const projectId of checkedProjectIds) {+ if (!loadedProjectIds.has(projectId)) {+ checkedProjectIds.delete(projectId);+ }+ }for (const project of projects) {if (checkedProjectIds.has(project.id)) {@@ -88,7 +99,7 @@ export const createGalleryBoardReferenceCheck = (checkedProjectIds.add(project.id);getProjectGalleryBoardReferences(project)- .filter((boardId) => !askedBoardIds.has(boardId))+ .filter((boardId) => !unansweredBoardIds.has(boardId)).forEach(ask);}};