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.

feat(webv2): add topbar generation progress rail

joshistoaste90d6c3b42af
diff --git a/invokeai/frontend/webv2/src/features/queue/contracts.ts b/invokeai/frontend/webv2/src/features/queue/contracts.ts
index 1a73167c7e..9abb75e5a9 100644
--- a/invokeai/frontend/webv2/src/features/queue/contracts.ts
+++ b/invokeai/frontend/webv2/src/features/queue/contracts.ts
@@ -43,6 +43,12 @@ export {
type QueueProgressBarState,
type QueueSummary,
} from './core/historySummary';
+export {
+ getProgressRailModel,
+ getProgressRailSegmentValue,
+ selectProjectProgressItemIds,
+ type ProgressRailModel,
+} from './core/progressRail';
export {
BACKEND_SUBMITTABLE_SOURCE_IDS,
isBackendSubmittableSourceId,
diff --git a/invokeai/frontend/webv2/src/features/queue/core/progressRail.test.ts b/invokeai/frontend/webv2/src/features/queue/core/progressRail.test.ts
new file mode 100644
index 0000000000..f5eda86d12
--- /dev/null
+++ b/invokeai/frontend/webv2/src/features/queue/core/progressRail.test.ts
@@ -0,0 +1,114 @@
+import type { QueueItem } from '@features/queue';
+
+import { describe, expect, it } from 'vitest';
+
+import { getProgressRailModel, getProgressRailSegmentValue, selectProjectProgressItemIds } from './progressRail';
+
+const createQueueItem = ({
+ backendItemIds,
+ id,
+ status = 'pending',
+}: {
+ backendItemIds?: number[];
+ id: string;
+ status?: QueueItem['status'];
+}): QueueItem => ({
+ backendItemIds,
+ cancellable: true,
+ id,
+ snapshot: {
+ backendSubmission: { error: 'not submitted in rail tests', kind: 'invalid' },
+ destination: 'gallery',
+ filterIntermediateResults: false,
+ galleryBoardId: null,
+ graph: { edges: [], id: 'graph-1', label: 'Graph', nodes: [], updatedAt: '2026-08-15T00:00:00.000Z', version: 1 },
+ presentation: { batchCount: 1, height: 1024, width: 1024 },
+ sourceId: 'generate',
+ submittedAt: '2026-08-15T00:00:00.000Z',
+ },
+ status,
+});
+
+describe('getProgressRailModel', () => {
+ it('hides while disconnected, even with live sessions', () => {
+ expect(getProgressRailModel({ hasOpenWork: true, isConnected: false, sessionItemIds: [1] })).toEqual({
+ kind: 'hidden',
+ });
+ });
+
+ it('hides when the project has no open work', () => {
+ expect(getProgressRailModel({ hasOpenWork: false, isConnected: true, sessionItemIds: [] })).toEqual({
+ kind: 'hidden',
+ });
+ });
+
+ it('shows a single pending segment between enqueue and the first progress event', () => {
+ expect(getProgressRailModel({ hasOpenWork: true, isConnected: true, sessionItemIds: [] })).toEqual({
+ kind: 'pending',
+ });
+ });
+
+ it('gives every live session its own segment', () => {
+ expect(getProgressRailModel({ hasOpenWork: true, isConnected: true, sessionItemIds: [7, 8] })).toEqual({
+ itemIds: [7, 8],
+ kind: 'sessions',
+ });
+ });
+});
+
+describe('getProgressRailSegmentValue', () => {
+ it('passes a real percentage through', () => {
+ expect(getProgressRailSegmentValue({ isLoadingModels: false, percentage: 0.42 })).toBe(0.42);
+ });
+
+ it('treats a missing percentage as indeterminate', () => {
+ expect(getProgressRailSegmentValue({ isLoadingModels: false, percentage: null })).toBeNull();
+ expect(getProgressRailSegmentValue({ isLoadingModels: false, percentage: undefined })).toBeNull();
+ });
+
+ it('treats zero as indeterminate rather than as an empty bar', () => {
+ expect(getProgressRailSegmentValue({ isLoadingModels: false, percentage: 0 })).toBeNull();
+ });
+
+ it('stays indeterminate while models load, whatever the last percentage was', () => {
+ expect(getProgressRailSegmentValue({ isLoadingModels: true, percentage: 0.9 })).toBeNull();
+ });
+});
+
+describe('selectProjectProgressItemIds', () => {
+ it('keeps only the ids this project enqueued', () => {
+ const items = [createQueueItem({ backendItemIds: [10, 11], id: 'batch-1', status: 'running' })];
+
+ expect(selectProjectProgressItemIds(items, [9, 10, 11, 12])).toEqual([10, 11]);
+ });
+
+ it('preserves ascending order so segments do not swap places between frames', () => {
+ const items = [
+ createQueueItem({ backendItemIds: [30], id: 'batch-2', status: 'running' }),
+ createQueueItem({ backendItemIds: [20], id: 'batch-1', status: 'running' }),
+ ];
+
+ expect(selectProjectProgressItemIds(items, [20, 30])).toEqual([20, 30]);
+ });
+
+ it('ignores items that are no longer open', () => {
+ const items = [
+ createQueueItem({ backendItemIds: [40], id: 'batch-1', status: 'completed' }),
+ createQueueItem({ backendItemIds: [41], id: 'batch-2', status: 'running' }),
+ ];
+
+ expect(selectProjectProgressItemIds(items, [40, 41])).toEqual([41]);
+ });
+
+ it('returns nothing when the store has no live sessions', () => {
+ const items = [createQueueItem({ backendItemIds: [50], id: 'batch-1', status: 'running' })];
+
+ expect(selectProjectProgressItemIds(items, [])).toEqual([]);
+ });
+
+ it('tolerates open items that have not been assigned backend ids yet', () => {
+ const items = [createQueueItem({ id: 'batch-1', status: 'pending' })];
+
+ expect(selectProjectProgressItemIds(items, [60])).toEqual([]);
+ });
+});
diff --git a/invokeai/frontend/webv2/src/features/queue/core/progressRail.ts b/invokeai/frontend/webv2/src/features/queue/core/progressRail.ts
new file mode 100644
index 0000000000..ed096edb46
--- /dev/null
+++ b/invokeai/frontend/webv2/src/features/queue/core/progressRail.ts
@@ -0,0 +1,93 @@
+import type { QueueItem } from './historyTypes';
+
+import { isOpenQueueItem } from './historySummary';
+
+/**
+ * The read model behind the top bar's progress rail — the one full-width,
+ * always-present generation indicator.
+ *
+ * It is deliberately a *list* of segments rather than a single value. With
+ * `generation_devices` (default `auto`) the backend runs one session per GPU,
+ * so several images render at once; every other progress surface in the app
+ * collapses to `runningQueueItemId` and therefore reports one of them as if it
+ * were the whole story. The rail gives each live session its own segment, the
+ * way the legacy progress bar did.
+ */
+
+export type ProgressRailModel =
+ | { kind: 'hidden' }
+ /** Work is open but no session has reported yet — one indeterminate segment. */
+ | { kind: 'pending' }
+ | { kind: 'sessions'; itemIds: readonly number[] };
+
+const HIDDEN: ProgressRailModel = { kind: 'hidden' };
+const PENDING: ProgressRailModel = { kind: 'pending' };
+const NO_ITEM_IDS: number[] = [];
+
+export const getProgressRailModel = ({
+ hasOpenWork,
+ isConnected,
+ sessionItemIds,
+}: {
+ hasOpenWork: boolean;
+ isConnected: boolean;
+ sessionItemIds: readonly number[];
+}): ProgressRailModel => {
+ // Offline, a frozen bar would claim progress that cannot be arriving. The
+ // server-status widget owns saying why.
+ if (!isConnected || !hasOpenWork) {
+ return HIDDEN;
+ }
+
+ return sessionItemIds.length > 0 ? { itemIds: sessionItemIds, kind: 'sessions' } : PENDING;
+};
+
+/**
+ * A segment's fill, or null for the indeterminate sweep.
+ *
+ * Zero is treated as indeterminate rather than as an empty bar: the backend
+ * reports `0` for the span between "session started" and "first step done",
+ * which is exactly when models are loading and the wait feels longest. An empty
+ * determinate bar reads as stalled there; the sweep reads as working.
+ */
+export const getProgressRailSegmentValue = ({
+ isLoadingModels,
+ percentage,
+}: {
+ isLoadingModels: boolean;
+ percentage: number | null | undefined;
+}): number | null =>
+ isLoadingModels || percentage === null || percentage === undefined || percentage === 0 ? null : percentage;
+
+/**
+ * The live sessions belonging to this project, in ascending id order.
+ *
+ * `itemProgressStore` is keyed by backend item id and spans the whole server
+ * queue, which on a multi-user backend includes other people's work; the rail
+ * sits beside a project-scoped queue readout, so it has to filter down to the
+ * ids this project actually enqueued.
+ */
+export const selectProjectProgressItemIds = (
+ queueItems: readonly QueueItem[],
+ activeItemIds: readonly number[]
+): number[] => {
+ if (activeItemIds.length === 0) {
+ return NO_ITEM_IDS;
+ }
+
+ const projectItemIds = new Set<number>();
+
+ for (const item of queueItems) {
+ if (!isOpenQueueItem(item)) {
+ continue;
+ }
+
+ for (const backendItemId of item.backendItemIds ?? []) {
+ projectItemIds.add(backendItemId);
+ }
+ }
+
+ // `activeItemIds` arrives sorted, so filtering preserves a stable
+ // left-to-right segment order across frames.
+ return activeItemIds.filter((itemId) => projectItemIds.has(itemId));
+};
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/TopBar.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/TopBar.tsx
index b1b284d688..00f3e722f2 100644
--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/TopBar.tsx
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/TopBar.tsx
@@ -7,6 +7,7 @@ import { LayoutPresetAdminDialogs } from './LayoutPresetAdminDialogs';
import { LayoutPresetManagerDialog } from './LayoutPresetManagerDialog';
import { LayoutPresetStrip } from './LayoutPresetStrip';
import { ProjectSwitcher } from './ProjectSwitcher';
+import { TopbarProgressRail } from './TopbarProgressRail';
/**
* The workbench top bar.
@@ -36,6 +37,9 @@ export const TopBar = () => (
gap="2"
gridTemplateColumns={TOPBAR_COLUMNS}
h="44px"
+ // Positioning context for the progress rail, which overlays the bottom
+ // border rather than taking a row of its own.
+ position="relative"
px="1.5"
w="full"
>
@@ -47,6 +51,8 @@ export const TopBar = () => (
<LayoutPresetStrip />
<InvocationCluster />
+
+ <TopbarProgressRail />
</Grid>
{/* Dialog hosts, not controls: every surface that can open one writes to a
store, so the body cannot belong to whichever trigger happens to be
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/TopbarProgressRail.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/TopbarProgressRail.tsx
new file mode 100644
index 0000000000..3a82d1a575
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/TopbarProgressRail.tsx
@@ -0,0 +1,132 @@
+import type { SystemStyleObject } from '@chakra-ui/react';
+import type { CSSProperties } from 'react';
+
+import { Box } from '@chakra-ui/react';
+import { useModelLoads } from '@features/models';
+import {
+ getProgressRailModel,
+ getProgressRailSegmentValue,
+ getQueueSummary,
+ selectProjectProgressItemIds,
+} from '@features/queue/contracts';
+import { useActiveProgressItemIds, useItemProgress } from '@features/queue/react';
+import { useActiveProjectSelector, useWorkbenchSelector } from '@workbench/WorkbenchContext';
+import { useMemo } from 'react';
+
+/**
+ * The application's primary generation indicator: a hairline that lights up
+ * along the whole bottom edge of the top bar while work is in flight.
+ *
+ * Everything else that shows progress — the Invoke icon ring, the queue
+ * readout, the preview overlay, the gallery placeholders — is small, and most
+ * of it only exists if the user happens to have that widget on screen. A rail
+ * spanning the viewport is detectable without being looked at, and it is
+ * present in every layout, which is what the legacy bar under the Invoke button
+ * had and this app lost.
+ *
+ * It sits *over* the top bar's 1px divider rather than below it, so appearing
+ * and disappearing costs no reflow and reads as the existing line lighting up
+ * rather than as a new element shoving the workspace down.
+ *
+ * Sessions divide the width instead of stacking: a 2px rail cannot stack to
+ * four GPUs without either growing into the workspace or shrinking below
+ * visibility, and side-by-side segments filling in parallel say "four things are
+ * running" at a glance.
+ *
+ * Not exposed to assistive tech — the queue cluster already owns a throttled
+ * live region for this, and a second announcer would only double the chatter.
+ */
+
+const RAIL_SX: SystemStyleObject = {
+ bottom: '-1px',
+ display: 'flex',
+ gap: '1px',
+ height: '2px',
+ insetInline: 0,
+ pointerEvents: 'none',
+ position: 'absolute',
+ zIndex: 3,
+};
+
+export const TopbarProgressRail = () => {
+ const queueItems = useActiveProjectSelector((project) => project.queue.items);
+ const isConnected = useWorkbenchSelector((snapshot) => snapshot.backendConnection.status === 'connected');
+ const isLoadingModels = useModelLoads().length > 0;
+ const activeItemIds = useActiveProgressItemIds();
+
+ const sessionItemIds = useMemo(
+ () => selectProjectProgressItemIds(queueItems, activeItemIds),
+ [activeItemIds, queueItems]
+ );
+
+ const model = getProgressRailModel({
+ hasOpenWork: getQueueSummary(queueItems).total > 0,
+ isConnected,
+ sessionItemIds,
+ });
+
+ if (model.kind === 'hidden') {
+ return null;
+ }
+
+ return (
+ <Box aria-hidden="true" css={RAIL_SX}>
+ {model.kind === 'pending' ? (
+ <RailSegment isLoadingModels={isLoadingModels} itemId={null} />
+ ) : (
+ model.itemIds.map((itemId) => <RailSegment isLoadingModels={isLoadingModels} itemId={itemId} key={itemId} />)
+ )}
+ </Box>
+ );
+};
+
+const SEGMENT_SX: SystemStyleObject = {
+ flex: '1 1 0',
+ minWidth: 0,
+ overflow: 'hidden',
+ position: 'relative',
+};
+
+const DETERMINATE_SX: SystemStyleObject = {
+ bg: 'accent.solid',
+ height: 'full',
+ transition: 'width var(--wb-motion-duration-fast) linear',
+};
+
+// Reuses Chakra's built-in `position` keyframe, the same one its own
+// indeterminate Progress range animates on.
+const INDETERMINATE_SX: SystemStyleObject = {
+ '--animate-from-x': '-45%',
+ '--animate-to-x': '100%',
+ animation: 'position 1.1s ease infinite',
+ backgroundImage: 'linear-gradient(to right, transparent, {colors.accent.solid}, transparent)',
+ insetBlock: 0,
+ minWidth: '45%',
+ position: 'absolute',
+ // With motion off there is no sweep to fall back on, so the segment becomes a
+ // quiet static fill: still "something is running", minus the movement. Spelled
+ // as a raw selector because the `_reduceMotion` condition this repo defines is
+ // only typed inside token values, not in style objects.
+ ':root[data-reduce-motion=true] &': {
+ animation: 'none',
+ backgroundImage: 'none',
+ bg: 'accent.solid/40',
+ insetInline: 0,
+ },
+};
+
+/**
+ * One session's fill. Each segment subscribes to its own item so a step event
+ * on one GPU does not re-render the other GPUs' segments — or the top bar.
+ */
+const RailSegment = ({ isLoadingModels, itemId }: { isLoadingModels: boolean; itemId: number | null }) => {
+ const progress = useItemProgress(itemId);
+ const value = getProgressRailSegmentValue({ isLoadingModels, percentage: progress?.percentage });
+ const fillStyle = useMemo<CSSProperties>(() => ({ width: value === null ? undefined : `${value * 100}%` }), [value]);
+
+ return (
+ <Box css={SEGMENT_SX}>
+ {value === null ? <Box css={INDETERMINATE_SX} /> : <Box css={DETERMINATE_SX} style={fillStyle} />}
+ </Box>
+ );
+};