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(webv2): shorten the product label in progress tab titles
joshistoast85028eb7ffbb
diff --git a/invokeai/frontend/webv2/src/workbench/shell/documentTitle.test.ts b/invokeai/frontend/webv2/src/workbench/shell/documentTitle.test.tsindex adeff676a6..ed253ef5db 100644--- a/invokeai/frontend/webv2/src/workbench/shell/documentTitle.test.ts+++ b/invokeai/frontend/webv2/src/workbench/shell/documentTitle.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest';-import { DOCUMENT_TITLE_BASE, formatDocumentTitle } from './documentTitle';+import { DOCUMENT_TITLE_BASE, DOCUMENT_TITLE_PRODUCT, formatDocumentTitle } from './documentTitle';const labels = { generating: 'Generating', queued: '3 queued' };@@ -11,27 +11,39 @@ describe('formatDocumentTitle', () => {it('reports the backlog before anything starts running', () => {expect(formatDocumentTitle({ current: 0, labels, percent: null, total: 3 })).toBe(- `3 queued · ${DOCUMENT_TITLE_BASE}`+ `3 queued · ${DOCUMENT_TITLE_PRODUCT}`);});it('leads with percent and position for a multi-image batch', () => {expect(formatDocumentTitle({ current: 2, labels, percent: 42, total: 8 })).toBe(- `42% · 2/8 · ${DOCUMENT_TITLE_BASE}`+ `42% · 2/8 · ${DOCUMENT_TITLE_PRODUCT}`);});it('drops the position for a single image', () => {- expect(formatDocumentTitle({ current: 1, labels, percent: 42, total: 1 })).toBe(`42% · ${DOCUMENT_TITLE_BASE}`);+ expect(formatDocumentTitle({ current: 1, labels, percent: 42, total: 1 })).toBe(`42% · ${DOCUMENT_TITLE_PRODUCT}`);});it('falls back to a word when a single image has no percentage yet', () => {expect(formatDocumentTitle({ current: 1, labels, percent: null, total: 1 })).toBe(- `Generating · ${DOCUMENT_TITLE_BASE}`+ `Generating · ${DOCUMENT_TITLE_PRODUCT}`);});it('still shows the position when a batch has no percentage yet', () => {- expect(formatDocumentTitle({ current: 2, labels, percent: null, total: 8 })).toBe(`2/8 · ${DOCUMENT_TITLE_BASE}`);+ expect(formatDocumentTitle({ current: 2, labels, percent: null, total: 8 })).toBe(+ `2/8 · ${DOCUMENT_TITLE_PRODUCT}`+ );+ });++ it('trails a running title with the short label, not the idle one', () => {+ // The whole point of the split: the idle title names the product in full,+ // and a running title spends that width on the numbers instead.+ const running = formatDocumentTitle({ current: 2, labels, percent: 42, total: 8 });++ expect(DOCUMENT_TITLE_PRODUCT.length).toBeLessThan(DOCUMENT_TITLE_BASE.length);+ expect(running).not.toContain(DOCUMENT_TITLE_BASE);+ expect(running.endsWith(DOCUMENT_TITLE_PRODUCT)).toBe(true);});});diff --git a/invokeai/frontend/webv2/src/workbench/shell/documentTitle.ts b/invokeai/frontend/webv2/src/workbench/shell/documentTitle.tsindex 3f518719fa..24bbbaaf27 100644--- a/invokeai/frontend/webv2/src/workbench/shell/documentTitle.ts+++ b/invokeai/frontend/webv2/src/workbench/shell/documentTitle.ts@@ -10,6 +10,15 @@/** Mirrors the static `<title>` in index.html, which is what we restore to. */export const DOCUMENT_TITLE_BASE = 'Invoke V7 Workbench';+/**+ * The trailing label while a batch runs, deliberately shorter than the idle+ * title. The idle title can afford to name the product precisely; a running one+ * is competing for the same few characters as the numbers, and those are the+ * part worth reading. Spending the width on "V7 Workbench" is what pushes the+ * percent out of a pinned or crowded tab.+ */+export const DOCUMENT_TITLE_PRODUCT = 'Invoke';+export interface DocumentTitleLabels {/** Fallback for "running, but nothing quantified yet", e.g. "Generating". */generating: string;@@ -22,14 +31,18 @@ export const formatDocumentTitle = ({current,labels,percent,+ productLabel = DOCUMENT_TITLE_PRODUCT,total,}: {+ /** Shown when nothing is running; restored verbatim on unmount. */baseTitle?: string;/** One-based ordinal of the image being generated; 0 when nothing has started. */current: number;labels: DocumentTitleLabels;/** Whole percent for the active image, or null while indeterminate. */percent: number | null;+ /** Trails the progress numbers, where width is scarce. */+ productLabel?: string;total: number;}): string => {if (total === 0) {@@ -37,10 +50,10 @@ export const formatDocumentTitle = ({}if (current === 0) {- return `${labels.queued} · ${baseTitle}`;+ return `${labels.queued} · ${productLabel}`;}const parts = [percent === null ? null : `${percent}%`, total > 1 ? `${current}/${total}` : null].filter(Boolean);- return `${parts.length > 0 ? parts.join(' · ') : labels.generating} · ${baseTitle}`;+ return `${parts.length > 0 ? parts.join(' · ') : labels.generating} · ${productLabel}`;};