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(ui): image map live refresh, status footer, hover thumbnails

Lincoln Stein4c50952725d9
diff --git a/invokeai/frontend/webv2/src/workbench/accountOwnedUiStores.test.ts b/invokeai/frontend/webv2/src/workbench/accountOwnedUiStores.test.ts
index 8938b02c0a..6a491d29c3 100644
--- a/invokeai/frontend/webv2/src/workbench/accountOwnedUiStores.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/accountOwnedUiStores.test.ts
@@ -19,6 +19,7 @@ describe('account-owned workbench UI stores', () => {
// Partial stand-in: the snapshot only needs to be observably non-empty.
imageMapStore.patchSnapshot({
data: { pointCount: 1, state: 'ready' } as unknown as ImageMapPoints,
+ indexCounts: { embedded: 1, pending: 0, total: 1 },
loadState: 'loaded',
});
@@ -32,6 +33,7 @@ describe('account-owned workbench UI stores', () => {
expect(imageMapSnapshot.data).toBeNull();
expect(imageMapSnapshot.loadState).toBe('idle');
expect(imageMapSnapshot.error).toBeNull();
+ expect(imageMapSnapshot.indexCounts).toBeNull();
unregisterModal();
});
});
diff --git a/invokeai/frontend/webv2/src/workbench/image-map/events.ts b/invokeai/frontend/webv2/src/workbench/image-map/events.ts
new file mode 100644
index 0000000000..b3ab910df0
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/image-map/events.ts
@@ -0,0 +1,29 @@
+/**
+ * Typed contracts for the backend Socket.IO events the image map consumes.
+ * Payload shapes mirror the pydantic models in
+ * `invokeai/app/services/events/events_common.py` (serialized as snake_case).
+ * These events belong to the image-map domain, so they live here rather than
+ * in a feature's event map.
+ */
+
+/** Embedding-index progress counts. Routed to admins only by the backend. */
+export interface ImageIndexStatusEvent {
+ total: number;
+ embedded: number;
+ pending: number;
+}
+
+/**
+ * Counts-free poke to one user whose images were just (re)embedded, routed
+ * to that user's room only. This is what lets a non-admin's map refresh
+ * after their own generations: the status event above never reaches them.
+ */
+export interface ImageIndexUpdatedEvent {
+ user_id: string;
+}
+
+/** A user's image map projection finished recomputing (user + admin rooms). */
+export interface ImageMapProjectionReadyEvent {
+ user_id: string;
+ point_count: number;
+}
diff --git a/invokeai/frontend/webv2/src/workbench/image-map/imageMap.test.ts b/invokeai/frontend/webv2/src/workbench/image-map/imageMap.test.ts
index afbc997dd5..927e960851 100644
--- a/invokeai/frontend/webv2/src/workbench/image-map/imageMap.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-map/imageMap.test.ts
@@ -82,7 +82,7 @@ describe('image map api', () => {
describe('image map store', () => {
beforeEach(() => {
mocks.apiFetchJson.mockReset();
- imageMapStore.setSnapshot({ data: null, error: null, loadState: 'idle', renderError: null });
+ imageMapStore.setSnapshot({ data: null, error: null, indexCounts: null, loadState: 'idle', renderError: null });
});
it('loads points into the snapshot', async () => {
@@ -185,6 +185,7 @@ describe('snapshot transitions', () => {
imageMapStore.setSnapshot({
data: null,
error: 'boom',
+ indexCounts: null,
loadState: 'error',
renderError: null,
});
@@ -210,6 +211,7 @@ describe('snapshot transitions', () => {
imageMapStore.setSnapshot({
data: null,
error: null,
+ indexCounts: null,
loadState: 'loaded',
renderError: 'The map failed to render (WebGL unavailable).',
});
diff --git a/invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts b/invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts
index 0e3aef6b7d..885e4ea0d5 100644
--- a/invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts
@@ -16,10 +16,18 @@ import { fetchImageMapPoints } from './api';
* driven by user action now and by socket events in a later runtime.
*/
+export interface ImageIndexCounts {
+ total: number;
+ embedded: number;
+ pending: number;
+}
+
export interface ImageMapSnapshot {
data: ImageMapPoints | null;
loadState: 'idle' | 'loading' | 'loaded' | 'error';
error: string | null;
+ /** Embedding-index progress; only ever pushed to admins by the backend. */
+ indexCounts: ImageIndexCounts | null;
/**
* The plot canvas itself failed (WebGL unavailable). Distinct from `error`,
* which means a fetch failed: with `error` the cached points are still worth
@@ -32,6 +40,7 @@ export interface ImageMapSnapshot {
const EMPTY_IMAGE_MAP_SNAPSHOT: ImageMapSnapshot = {
data: null,
error: null,
+ indexCounts: null,
loadState: 'idle',
renderError: null,
};
@@ -39,12 +48,14 @@ const EMPTY_IMAGE_MAP_SNAPSHOT: ImageMapSnapshot = {
export const imageMapStore = createExternalStore<ImageMapSnapshot>(EMPTY_IMAGE_MAP_SNAPSHOT);
let inflight: Promise<void> | null = null;
+let rerunRequested = false;
// The projection is per-user server state: a login/logout must drop it before
// the next account's widgets can observe it.
registerAccountOwnedResource({
clear: () => {
inflight = null;
+ rerunRequested = false;
imageMapStore.setSnapshot(EMPTY_IMAGE_MAP_SNAPSHOT);
},
name: 'image-map',
@@ -52,6 +63,11 @@ registerAccountOwnedResource({
export const refreshImageMapPoints = (): Promise<void> => {
if (inflight) {
+ // A refresh requested mid-flight (e.g. projection_ready arriving while
+ // the fetch that triggered the recompute is still running) must not be
+ // swallowed by the dedup: run once more when the current fetch settles.
+ rerunRequested = true;
+
return inflight;
}
@@ -88,6 +104,11 @@ export const refreshImageMapPoints = (): Promise<void> => {
if (inflight === refresh) {
inflight = null;
}
+
+ if (rerunRequested) {
+ rerunRequested = false;
+ void refreshImageMapPoints();
+ }
});
inflight = refresh;
diff --git a/invokeai/frontend/webv2/src/workbench/image-map/thumbnailCache.test.ts b/invokeai/frontend/webv2/src/workbench/image-map/thumbnailCache.test.ts
new file mode 100644
index 0000000000..2c1e7c16b2
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/image-map/thumbnailCache.test.ts
@@ -0,0 +1,53 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+const mocks = vi.hoisted(() => ({
+ resolveMany: vi.fn(),
+}));
+
+vi.mock('@features/gallery', () => ({
+ galleryImages: { resolveMany: mocks.resolveMany },
+}));
+
+import { accountLifecycle } from '@platform/state/accountLifecycle';
+
+import { getThumbnailUrl } from './thumbnailCache';
+
+describe('image map thumbnail cache', () => {
+ beforeEach(() => {
+ mocks.resolveMany.mockReset();
+ accountLifecycle.activate('user-a');
+ });
+
+ it('caches resolved URLs per image name', async () => {
+ mocks.resolveMany.mockResolvedValue([{ thumbnailUrl: '/thumbs/a.png' }]);
+
+ await expect(getThumbnailUrl('a.png')).resolves.toBe('/thumbs/a.png');
+ await expect(getThumbnailUrl('a.png')).resolves.toBe('/thumbs/a.png');
+ expect(mocks.resolveMany).toHaveBeenCalledTimes(1);
+ });
+
+ it('clears settled entries and stale in-flight results on account invalidation', async () => {
+ mocks.resolveMany.mockResolvedValue([{ thumbnailUrl: '/thumbs/user-a.png' }]);
+ await getThumbnailUrl('a.png');
+
+ // A request still in flight when the account switches must not seed the
+ // next account's cache.
+ let resolveLate: (images: { thumbnailUrl: string }[]) => void = () => {};
+ mocks.resolveMany.mockImplementation(
+ () =>
+ new Promise((resolve) => {
+ resolveLate = resolve;
+ })
+ );
+ const late = getThumbnailUrl('b.png');
+
+ accountLifecycle.invalidate();
+ resolveLate([{ thumbnailUrl: '/thumbs/stale-b.png' }]);
+ await late;
+
+ accountLifecycle.activate('user-b');
+ mocks.resolveMany.mockResolvedValue([{ thumbnailUrl: '/thumbs/user-b.png' }]);
+ await expect(getThumbnailUrl('a.png')).resolves.toBe('/thumbs/user-b.png');
+ await expect(getThumbnailUrl('b.png')).resolves.toBe('/thumbs/user-b.png');
+ });
+});
diff --git a/invokeai/frontend/webv2/src/workbench/image-map/thumbnailCache.ts b/invokeai/frontend/webv2/src/workbench/image-map/thumbnailCache.ts
new file mode 100644
index 0000000000..628e98ab29
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/image-map/thumbnailCache.ts
@@ -0,0 +1,64 @@
+import { galleryImages } from '@features/gallery';
+import {
+ captureAccountScope,
+ isAccountScopeCurrent,
+ registerAccountOwnedResource,
+} from '@platform/state/accountLifecycle';
+
+/**
+ * Image-name → thumbnail-URL cache for map hover previews. Thumbnail URLs are
+ * derived from the immutable image name, so unlike full DTOs they never go
+ * stale and can be cached for the session.
+ */
+const urls = new Map<string, string | null>();
+const inflight = new Map<string, Promise<string | null>>();
+
+// Thumbnail URLs are account-owned gallery data: drop them on login/logout so
+// one account's map hovers can never serve another account's thumbnails.
+registerAccountOwnedResource({
+ clear: () => {
+ urls.clear();
+ inflight.clear();
+ },
+ name: 'image-map-thumbnails',
+});
+
+export const getThumbnailUrl = (imageName: string): Promise<string | null> => {
+ const cached = urls.get(imageName);
+
+ if (cached !== undefined) {
+ return Promise.resolve(cached);
+ }
+
+ const pending = inflight.get(imageName);
+
+ if (pending) {
+ return pending;
+ }
+
+ const owner = captureAccountScope();
+ const request = galleryImages
+ .resolveMany([imageName])
+ .then((images) => {
+ const url = images.at(0)?.thumbnailUrl ?? null;
+
+ // A resolution that raced an account switch must not seed the next
+ // account's cache.
+ if (isAccountScopeCurrent(owner)) {
+ urls.set(imageName, url);
+ }
+
+ return url;
+ })
+ .catch(() => null)
+ .finally(() => {
+ // Release only this request's claim; an account switch already cleared
+ // the in-flight map.
+ if (inflight.get(imageName) === request) {
+ inflight.delete(imageName);
+ }
+ });
+ inflight.set(imageName, request);
+
+ return request;
+};
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.test.ts
new file mode 100644
index 0000000000..3c0481c7de
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.test.ts
@@ -0,0 +1,116 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+const mocks = vi.hoisted(() => ({
+ onConnectionChange: vi.fn(),
+ refreshImageMapPoints: vi.fn(),
+ socketOn: vi.fn(),
+}));
+
+vi.mock('@platform/transport/socketHub', () => ({
+ socketHub: {
+ on: mocks.socketOn,
+ onConnectionChange: mocks.onConnectionChange,
+ },
+}));
+
+vi.mock('@workbench/image-map/imageMapStore', async (importOriginal) => {
+ const original = (await importOriginal()) as object;
+
+ return { ...original, refreshImageMapPoints: mocks.refreshImageMapPoints };
+});
+
+import { imageMapStore } from '@workbench/image-map/imageMapStore';
+
+import { attachImageMapDataRuntime } from './ImageMapDataRuntime';
+
+const getHandler = (event: string): ((payload?: unknown) => void) => {
+ const call = mocks.socketOn.mock.calls.find(([name]) => name === event);
+ expect(call, `no listener for ${event}`).toBeDefined();
+
+ return call![1];
+};
+
+describe('attachImageMapDataRuntime', () => {
+ beforeEach(() => {
+ mocks.socketOn.mockReset().mockReturnValue(() => {});
+ mocks.onConnectionChange.mockReset().mockReturnValue(() => {});
+ mocks.refreshImageMapPoints.mockReset();
+ imageMapStore.setSnapshot({ data: null, error: null, indexCounts: null, loadState: 'idle', renderError: null });
+ });
+
+ it('refreshes on projection-ready only after the map has been loaded once', () => {
+ const detach = attachImageMapDataRuntime();
+ const onReady = getHandler('image_map_projection_ready');
+
+ onReady();
+ expect(mocks.refreshImageMapPoints).not.toHaveBeenCalled();
+
+ imageMapStore.patchSnapshot({ loadState: 'loaded' });
+ onReady();
+ expect(mocks.refreshImageMapPoints).toHaveBeenCalledTimes(1);
+
+ detach();
+ });
+
+ it('stores index progress counts from status events', () => {
+ const detach = attachImageMapDataRuntime();
+
+ getHandler('image_index_status')({ embedded: 3, pending: 2, total: 5 });
+
+ expect(imageMapStore.getSnapshot().indexCounts).toEqual({ embedded: 3, pending: 2, total: 5 });
+ detach();
+ });
+
+ it('refreshes a loaded map when a status event reports the index quiescent', () => {
+ const detach = attachImageMapDataRuntime();
+ const onStatus = getHandler('image_index_status');
+
+ // Not yet loaded: counts are stored but nothing refetches.
+ onStatus({ embedded: 5, pending: 0, total: 5 });
+ expect(mocks.refreshImageMapPoints).not.toHaveBeenCalled();
+
+ imageMapStore.patchSnapshot({ loadState: 'loaded' });
+ // Mid-backfill events keep the map quiet; only quiescence pokes /points.
+ onStatus({ embedded: 3, pending: 2, total: 5 });
+ expect(mocks.refreshImageMapPoints).not.toHaveBeenCalled();
+
+ onStatus({ embedded: 5, pending: 0, total: 5 });
+ expect(mocks.refreshImageMapPoints).toHaveBeenCalledTimes(1);
+
+ detach();
+ });
+
+ it('refreshes a loaded map on the per-user index-updated poke', () => {
+ const detach = attachImageMapDataRuntime();
+ const onUpdated = getHandler('image_index_updated');
+
+ onUpdated({ user_id: 'u1' });
+ expect(mocks.refreshImageMapPoints).not.toHaveBeenCalled();
+
+ imageMapStore.patchSnapshot({ loadState: 'loaded' });
+ onUpdated({ user_id: 'u1' });
+ expect(mocks.refreshImageMapPoints).toHaveBeenCalledTimes(1);
+
+ detach();
+ });
+
+ it('refreshes a loaded map when the socket reconnects, and detaches cleanly', () => {
+ const detachSocket = vi.fn();
+ const detachConnection = vi.fn();
+ mocks.socketOn.mockReturnValue(detachSocket);
+ mocks.onConnectionChange.mockReturnValue(detachConnection);
+
+ const detach = attachImageMapDataRuntime();
+ const onConnection = mocks.onConnectionChange.mock.calls[0][0];
+
+ imageMapStore.patchSnapshot({ loadState: 'error' });
+ onConnection('connected');
+ expect(mocks.refreshImageMapPoints).toHaveBeenCalledTimes(1);
+ onConnection('disconnected');
+ expect(mocks.refreshImageMapPoints).toHaveBeenCalledTimes(1);
+
+ detach();
+ expect(detachSocket).toHaveBeenCalledTimes(3);
+ expect(detachConnection).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.tsx b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.tsx
new file mode 100644
index 0000000000..b49ccae1c9
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.tsx
@@ -0,0 +1,71 @@
+import type { ImageIndexStatusEvent } from '@workbench/image-map/events';
+
+import { useMountEffect } from '@platform/react/useMountEffect';
+import { socketHub } from '@platform/transport/socketHub';
+import { imageMapStore, refreshImageMapPoints } from '@workbench/image-map/imageMapStore';
+
+/**
+ * Socket-driven refresh for the image map, replacing polling: when the
+ * backend announces a recomputed projection (or the socket reconnects after
+ * an outage), the point set refetches. Index progress counts feed the footer.
+ * Nothing fetches until the widget itself has loaded the map once — a user
+ * who never opens the Image Map pays nothing.
+ */
+export const attachImageMapDataRuntime = (): (() => void) => {
+ const refreshIfLoaded = () => {
+ if (imageMapStore.getSnapshot().loadState !== 'idle') {
+ void refreshImageMapPoints();
+ }
+ };
+
+ const detachers = [
+ // The backend routes this to the requesting user's room (plus admins),
+ // so any receipt means "my map changed".
+ socketHub.on('image_map_projection_ready', refreshIfLoaded),
+ // Counts-free per-user poke: the owner's images just reached the index.
+ // This is the only index signal non-admins receive (status events below
+ // are admin-only), so it is what makes a non-admin's map follow their
+ // own generations.
+ socketHub.on('image_index_updated', refreshIfLoaded),
+ socketHub.on('image_index_status', (payload: never) => {
+ const event = payload as unknown as ImageIndexStatusEvent;
+ imageMapStore.patchSnapshot({
+ indexCounts: { embedded: event.embedded, pending: event.pending, total: event.total },
+ });
+ // Quiescence is the moment the point set may have changed: batch
+ // completions, deletions, and the final sweep after failures all end
+ // in a pending === 0 emit (permanently-failed images are excluded
+ // from pending so it always drains). Refetching makes the backend
+ // compare scope hashes; if the map is stale it enqueues the recompute
+ // whose projection-ready event closes the loop above. Without this
+ // poke neither side ever initiates: the backend only recomputes when
+ // asked, and nothing else asks. Status events are admin-only (the
+ // counts aggregate every user's images); non-admins get the
+ // image_index_updated poke above for their own embeds, and manual
+ // refresh covers their deletions (the backend cannot resolve an
+ // owner for an already-deleted row).
+ if (event.pending === 0) {
+ refreshIfLoaded();
+ }
+ }),
+ ];
+ const detachConnection = socketHub.onConnectionChange((status) => {
+ if (status === 'connected') {
+ refreshIfLoaded();
+ }
+ });
+
+ return () => {
+ for (const detach of detachers) {
+ detach();
+ }
+ detachConnection();
+ };
+};
+
+/** React is only the idempotent lifecycle adapter for the non-React runtime. */
+export const ImageMapDataRuntime = () => {
+ useMountEffect(attachImageMapDataRuntime);
+
+ return null;
+};
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx
index 2e53f7ff7b..afead044b0 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx
@@ -18,9 +18,10 @@ import {
fitRangesToAspect,
rangesToKeepMarkerInView,
} from '@workbench/image-map/imageMapViewport';
+import { getThumbnailUrl } from '@workbench/image-map/thumbnailCache';
import { useWidgetValuesSelector } from '@workbench/WorkbenchContext';
import Plotly from 'plotly.js-gl2d-dist-min';
-import { useEffect, useRef } from 'react';
+import { useEffect, useRef, useState } from 'react';
import { useSelectMapImage } from './useSelectMapImage';
@@ -30,12 +31,22 @@ const PINCH_CLICK_SUPPRESS_MS = 500;
/** How long a map click may suppress the recenter its own selection causes. */
const MAP_CLICK_SUPPRESS_MS = 5000;
+/** Dwell before a hover thumbnail appears (PhotoMapAI's delay). */
+const HOVER_DELAY_MS = 150;
+
/** These plotly calls can reject on a plot whose WebGL init failed; the map
* already shows the store's error state, so the rejection itself is noise. */
const swallow = (promise: Promise<unknown>): void => {
promise.catch(() => {});
};
+interface HoverPreview {
+ imageName: string;
+ url: string;
+ clientX: number;
+ clientY: number;
+}
+
interface PlotElement extends PlotlyHTMLElement {
_fullLayout?: {
xaxis?: { range?: [number, number] };
@@ -117,6 +128,20 @@ const ImageMapPlot = () => {
pointsRef.current = points;
selectedImageNameRef.current = selectedImageName;
}, [points, selectedImageName]);
+ const [hoverPreview, setHoverPreview] = useState<HoverPreview | null>(null);
+ const hoverTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
+ // Monotonic hover session: a resolution from a previous hover (even of the
+ // same point) must neither show early nor at stale coordinates.
+ const hoverSessionRef = useRef(0);
+
+ const clearHover = () => {
+ hoverSessionRef.current += 1;
+ if (hoverTimerRef.current !== null) {
+ clearTimeout(hoverTimerRef.current);
+ hoverTimerRef.current = null;
+ }
+ setHoverPreview(null);
+ };
useEffect(() => {
const container = containerRef.current;
@@ -177,6 +202,30 @@ const ImageMapPlot = () => {
selectImage(imageName);
}
});
+ plot.removeAllListeners?.('plotly_hover');
+ plot.on('plotly_hover', (event) => {
+ const imageName = event.points?.[0]?.customdata;
+ const mouse = (event as { event?: MouseEvent }).event;
+
+ if (typeof imageName !== 'string' || !mouse) {
+ return;
+ }
+
+ clearHover();
+ const session = hoverSessionRef.current;
+ const { clientX, clientY } = mouse;
+ hoverTimerRef.current = setTimeout(() => {
+ void getThumbnailUrl(imageName).then((url) => {
+ if (url && hoverSessionRef.current === session && !disposed) {
+ setHoverPreview({ clientX, clientY, imageName, url });
+ }
+ });
+ }, HOVER_DELAY_MS);
+ });
+ plot.removeAllListeners?.('plotly_unhover');
+ plot.on('plotly_unhover', () => {
+ clearHover();
+ });
})
.catch(() => {
if (disposed) {
@@ -196,6 +245,7 @@ const ImageMapPlot = () => {
return () => {
disposed = true;
+ clearHover();
};
}, [points, selectImage]);
@@ -318,7 +368,33 @@ const ImageMapPlot = () => {
};
}, []);
- return <Box ref={containerRef} h="full" minH="0" w="full" />;
+ return (
+ <Box h="full" minH="0" position="relative" w="full">
+ <Box ref={containerRef} h="full" w="full" />
+ {hoverPreview ? (
+ <Box
+ borderColor="border.emphasized"
+ borderWidth="1px"
+ left={`${hoverPreview.clientX + 14}px`}
+ maxH="40"
+ maxW="40"
+ overflow="hidden"
+ pointerEvents="none"
+ position="fixed"
+ rounded="md"
+ shadow="lg"
+ top={`${hoverPreview.clientY + 14}px`}
+ zIndex="tooltip"
+ >
+ <img
+ alt={hoverPreview.imageName}
+ src={hoverPreview.url}
+ style={{ display: 'block', maxHeight: '10rem', maxWidth: '10rem' }}
+ />
+ </Box>
+ ) : null}
+ </Box>
+ );
};
export default ImageMapPlot;
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetFooter.tsx b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetFooter.tsx
new file mode 100644
index 0000000000..ee80a4f12f
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetFooter.tsx
@@ -0,0 +1,44 @@
+import type { WidgetViewProps } from '@workbench/widgetContracts';
+
+import { HStack, Icon, Text } from '@chakra-ui/react';
+import { IconButton, Tooltip } from '@platform/ui';
+import { imageMapStore, refreshImageMapPoints } from '@workbench/image-map/imageMapStore';
+import { RefreshCwIcon } from 'lucide-react';
+
+const handleRefresh = () => {
+ void refreshImageMapPoints();
+};
+
+/**
+ * Widget-chrome footer: point count, a stale hint while a recompute is
+ * pending, embedding-index progress (admins only receive those events), and
+ * a manual refresh.
+ */
+export const ImageMapWidgetFooter = (_props: WidgetViewProps) => {
+ const { data, indexCounts, loadState } = imageMapStore.useSnapshot();
+
+ if (loadState === 'idle' || !data) {
+ return null;
+ }
+
+ const indexing = indexCounts && indexCounts.pending > 0;
+
+ return (
+ <HStack borderTopWidth="1px" color="fg.muted" fontSize="2xs" gap="2" justify="space-between" px="3" py="1" w="full">
+ <HStack gap="2" minW="0">
+ <Text whiteSpace="nowrap">{data.pointCount} points</Text>
+ {data.stale ? <Text whiteSpace="nowrap">· updating…</Text> : null}
+ {indexing ? (
+ <Text truncate>
+ · indexing {indexCounts.embedded}/{indexCounts.total}
+ </Text>
+ ) : null}
+ </HStack>
+ <Tooltip content="Refresh map">
+ <IconButton aria-label="Refresh map" color="fg.muted" size="2xs" variant="ghost" onClick={handleRefresh}>
+ <Icon as={RefreshCwIcon} boxSize="3" />
+ </IconButton>
+ </Tooltip>
+ </HStack>
+ );
+};
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/image-map/implementation.ts b/invokeai/frontend/webv2/src/workbench/widgets/image-map/implementation.ts
index d6fe12186e..2491c0d27b 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/image-map/implementation.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/implementation.ts
@@ -1,7 +1,11 @@
import type { WidgetImplementation } from '@workbench/widgetContracts';
+import { ImageMapDataRuntime } from './ImageMapDataRuntime';
+import { ImageMapWidgetFooter } from './ImageMapWidgetFooter';
import { ImageMapWidgetView } from './ImageMapWidgetView';
export const widgetImplementation = {
+ footer: ImageMapWidgetFooter,
+ host: ImageMapDataRuntime,
view: ImageMapWidgetView,
} satisfies WidgetImplementation;
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/image-map/manifest.ts b/invokeai/frontend/webv2/src/workbench/widgets/image-map/manifest.ts
index b2d85ed661..495393b29d 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/image-map/manifest.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/manifest.ts
@@ -7,6 +7,7 @@ export const imageMapWidgetManifest: WidgetManifest = {
allowMultiple: false,
allowedRegions: ['left', 'right', 'center'],
failurePolicy: { isolateRenderFailure: true, onRegistrationFailure: 'disable' },
+ hasHost: true,
icon: MapIcon,
id: 'image-map',
label: (t) => t('widgets.labels.imageMap'),