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): keep live refresh from fighting the canvas, the first load, and other users
Lincoln Stein0b565036281a
diff --git a/invokeai/frontend/webv2/performance/browser-baseline.json b/invokeai/frontend/webv2/performance/browser-baseline.jsonindex 1da0663f17..90f0ee9608 100644--- a/invokeai/frontend/webv2/performance/browser-baseline.json+++ b/invokeai/frontend/webv2/performance/browser-baseline.json@@ -1,6 +1,6 @@{"browserExecutable": "/home/lstein/.cache/ms-playwright/chromium-1234/chrome-linux64/chrome",- "capturedAt": "2026-08-14",+ "capturedAt": "2026-08-15","routes": [{"activatedResourceBaseline": {@@ -25,11 +25,11 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 91.5,+ "domContentLoadedMedianMs": 176.90000009536743,"id": "launchpad","layoutSwitchMedianMs": 0,- "loadMedianMs": 91.5,- "longestTaskMaxMs": 55,+ "loadMedianMs": 176.90000009536743,+ "longestTaskMaxMs": 75,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -39,24 +39,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746314,- "otherRawBytes": 135056,+ "otherRawBytes": 135095,"requestCount": 36,- "scriptRawBytes": 1600050,+ "scriptRawBytes": 1600788,"scriptRequestCount": 32,- "totalRawBytes": 1760929+ "totalRawBytes": 1761706},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753778,- "otherRawBytes": 136407,+ "otherRawBytes": 136446,"requestCount": 36,- "scriptRawBytes": 1616051,+ "scriptRawBytes": 1616796,"scriptRequestCount": 32,- "totalRawBytes": 1778539+ "totalRawBytes": 1779324},- "routeReadyMedianMs": 204.7999997138977,+ "routeReadyMedianMs": 328.5,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "empty"},@@ -83,11 +83,11 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 91.80000019073486,+ "domContentLoadedMedianMs": 137.7999997138977,"id": "launchpad","layoutSwitchMedianMs": 0,- "loadMedianMs": 91.80000019073486,- "longestTaskMaxMs": 58,+ "loadMedianMs": 137.7999997138977,+ "longestTaskMaxMs": 70,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -97,24 +97,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746314,- "otherRawBytes": 135056,+ "otherRawBytes": 135095,"requestCount": 36,- "scriptRawBytes": 1600050,+ "scriptRawBytes": 1600788,"scriptRequestCount": 32,- "totalRawBytes": 1760929+ "totalRawBytes": 1761706},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753778,- "otherRawBytes": 136407,+ "otherRawBytes": 136446,"requestCount": 36,- "scriptRawBytes": 1616051,+ "scriptRawBytes": 1616796,"scriptRequestCount": 32,- "totalRawBytes": 1778539+ "totalRawBytes": 1779324},- "routeReadyMedianMs": 220.10000038146973,+ "routeReadyMedianMs": 307.19999980926514,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "representative"},@@ -141,13 +141,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 93.19999980926514,+ "domContentLoadedMedianMs": 151.2000002861023,"id": "editor-minimal","layoutSwitchMedianMs": 0,- "loadMedianMs": 93.19999980926514,- "longestTaskMaxMs": 74,+ "loadMedianMs": 151.30000019073486,+ "longestTaskMaxMs": 103,"owner": "workbench",- "projectSwitchMedianMs": 24.800000190734863,+ "projectSwitchMedianMs": 41.200000286102295,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -155,24 +155,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746314,- "otherRawBytes": 135056,- "requestCount": 111,- "scriptRawBytes": 3328252,- "scriptRequestCount": 105,- "totalRawBytes": 3660920+ "otherRawBytes": 135095,+ "requestCount": 113,+ "scriptRawBytes": 3342088,+ "scriptRequestCount": 107,+ "totalRawBytes": 3674795},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753778,- "otherRawBytes": 136407,- "requestCount": 111,- "scriptRawBytes": 3361535,- "scriptRequestCount": 105,- "totalRawBytes": 3697530+ "otherRawBytes": 136446,+ "requestCount": 113,+ "scriptRawBytes": 3375509,+ "scriptRequestCount": 107,+ "totalRawBytes": 3711543},- "routeReadyMedianMs": 571.8999996185303,+ "routeReadyMedianMs": 698.1000003814697,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -199,13 +199,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 89.69999980926514,+ "domContentLoadedMedianMs": 143.59999990463257,"id": "editor-minimal","layoutSwitchMedianMs": 0,- "loadMedianMs": 89.69999980926514,- "longestTaskMaxMs": 88,+ "loadMedianMs": 143.69999980926514,+ "longestTaskMaxMs": 108,"owner": "workbench",- "projectSwitchMedianMs": 40.90000009536743,+ "projectSwitchMedianMs": 61.40000009536743,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -213,24 +213,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746314,- "otherRawBytes": 135056,- "requestCount": 111,- "scriptRawBytes": 3328252,- "scriptRequestCount": 105,- "totalRawBytes": 3660920+ "otherRawBytes": 135095,+ "requestCount": 113,+ "scriptRawBytes": 3342088,+ "scriptRequestCount": 107,+ "totalRawBytes": 3674795},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753778,- "otherRawBytes": 136407,- "requestCount": 111,- "scriptRawBytes": 3361535,- "scriptRequestCount": 105,- "totalRawBytes": 3697530+ "otherRawBytes": 136446,+ "requestCount": 113,+ "scriptRawBytes": 3375509,+ "scriptRequestCount": 107,+ "totalRawBytes": 3711543},- "routeReadyMedianMs": 597,+ "routeReadyMedianMs": 774.6999998092651,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"},@@ -257,11 +257,11 @@"scriptRequestCount": 5,"totalRawBytes": 286586},- "domContentLoadedMedianMs": 91.90000009536743,+ "domContentLoadedMedianMs": 140.69999980926514,"id": "editor-canvas",- "layoutSwitchMedianMs": 54.19999980926514,- "loadMedianMs": 92,- "longestTaskMaxMs": 78,+ "layoutSwitchMedianMs": 70.30000019073486,+ "loadMedianMs": 140.69999980926514,+ "longestTaskMaxMs": 115,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -271,24 +271,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746314,- "otherRawBytes": 135056,- "requestCount": 116,- "scriptRawBytes": 3612000,- "scriptRequestCount": 110,- "totalRawBytes": 3944668+ "otherRawBytes": 135095,+ "requestCount": 118,+ "scriptRawBytes": 3625836,+ "scriptRequestCount": 112,+ "totalRawBytes": 3958543},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753778,- "otherRawBytes": 136407,- "requestCount": 116,- "scriptRawBytes": 3648120,- "scriptRequestCount": 110,- "totalRawBytes": 3984115+ "otherRawBytes": 136446,+ "requestCount": 118,+ "scriptRawBytes": 3662095,+ "scriptRequestCount": 112,+ "totalRawBytes": 3998129},- "routeReadyMedianMs": 996.5,+ "routeReadyMedianMs": 1218.5,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "empty"},@@ -315,11 +315,11 @@"scriptRequestCount": 5,"totalRawBytes": 286586},- "domContentLoadedMedianMs": 96.2000002861023,+ "domContentLoadedMedianMs": 142.2999997138977,"id": "editor-canvas",- "layoutSwitchMedianMs": 136.69999980926514,- "loadMedianMs": 96.2000002861023,- "longestTaskMaxMs": 284,+ "layoutSwitchMedianMs": 183.90000009536743,+ "loadMedianMs": 142.2999997138977,+ "longestTaskMaxMs": 365,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -329,24 +329,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746314,- "otherRawBytes": 135056,- "requestCount": 116,- "scriptRawBytes": 3612000,- "scriptRequestCount": 110,- "totalRawBytes": 3944668+ "otherRawBytes": 135095,+ "requestCount": 118,+ "scriptRawBytes": 3625836,+ "scriptRequestCount": 112,+ "totalRawBytes": 3958543},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753778,- "otherRawBytes": 136407,- "requestCount": 116,- "scriptRawBytes": 3648120,- "scriptRequestCount": 110,- "totalRawBytes": 3984115+ "otherRawBytes": 136446,+ "requestCount": 118,+ "scriptRawBytes": 3662095,+ "scriptRequestCount": 112,+ "totalRawBytes": 3998129},- "routeReadyMedianMs": 1106.6999998092651,+ "routeReadyMedianMs": 1359.9000000953674,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "representative"},@@ -373,11 +373,11 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 94,+ "domContentLoadedMedianMs": 165.19999980926514,"id": "editor-workflow",- "layoutSwitchMedianMs": 51.30000019073486,- "loadMedianMs": 94,- "longestTaskMaxMs": 75,+ "layoutSwitchMedianMs": 74.19999980926514,+ "loadMedianMs": 165.19999980926514,+ "longestTaskMaxMs": 102,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -387,24 +387,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746314,- "otherRawBytes": 135056,- "requestCount": 111,- "scriptRawBytes": 3328252,- "scriptRequestCount": 105,- "totalRawBytes": 3660920+ "otherRawBytes": 135095,+ "requestCount": 113,+ "scriptRawBytes": 3342088,+ "scriptRequestCount": 107,+ "totalRawBytes": 3674795},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753778,- "otherRawBytes": 136407,- "requestCount": 111,- "scriptRawBytes": 3361535,- "scriptRequestCount": 105,- "totalRawBytes": 3697530+ "otherRawBytes": 136446,+ "requestCount": 113,+ "scriptRawBytes": 3375509,+ "scriptRequestCount": 107,+ "totalRawBytes": 3711543},- "routeReadyMedianMs": 982.4000000953674,+ "routeReadyMedianMs": 1233.6999998092651,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -431,11 +431,11 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 96.09999990463257,+ "domContentLoadedMedianMs": 143.30000019073486,"id": "editor-workflow",- "layoutSwitchMedianMs": 85.59999990463257,- "loadMedianMs": 96.09999990463257,- "longestTaskMaxMs": 269,+ "layoutSwitchMedianMs": 117.40000009536743,+ "loadMedianMs": 143.30000019073486,+ "longestTaskMaxMs": 380,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -445,24 +445,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746314,- "otherRawBytes": 135056,- "requestCount": 111,- "scriptRawBytes": 3328252,- "scriptRequestCount": 105,- "totalRawBytes": 3660920+ "otherRawBytes": 135095,+ "requestCount": 113,+ "scriptRawBytes": 3342088,+ "scriptRequestCount": 107,+ "totalRawBytes": 3674795},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753778,- "otherRawBytes": 136407,- "requestCount": 111,- "scriptRawBytes": 3361535,- "scriptRequestCount": 105,- "totalRawBytes": 3697530+ "otherRawBytes": 136446,+ "requestCount": 113,+ "scriptRawBytes": 3375509,+ "scriptRequestCount": 107,+ "totalRawBytes": 3711543},- "routeReadyMedianMs": 1054,+ "routeReadyMedianMs": 1307,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"},@@ -489,11 +489,11 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 91.59999990463257,+ "domContentLoadedMedianMs": 138.90000009536743,"id": "editor-gallery",- "layoutSwitchMedianMs": 23.200000286102295,- "loadMedianMs": 91.59999990463257,- "longestTaskMaxMs": 73,+ "layoutSwitchMedianMs": 36,+ "loadMedianMs": 138.90000009536743,+ "longestTaskMaxMs": 103,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -503,24 +503,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746314,- "otherRawBytes": 135056,- "requestCount": 111,- "scriptRawBytes": 3328252,- "scriptRequestCount": 105,- "totalRawBytes": 3660920+ "otherRawBytes": 135095,+ "requestCount": 113,+ "scriptRawBytes": 3342088,+ "scriptRequestCount": 107,+ "totalRawBytes": 3674795},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753778,- "otherRawBytes": 136407,- "requestCount": 111,- "scriptRawBytes": 3361535,- "scriptRequestCount": 105,- "totalRawBytes": 3697530+ "otherRawBytes": 136446,+ "requestCount": 113,+ "scriptRawBytes": 3375509,+ "scriptRequestCount": 107,+ "totalRawBytes": 3711543},- "routeReadyMedianMs": 1230.5,+ "routeReadyMedianMs": 1469.1000003814697,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -547,11 +547,11 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 94,+ "domContentLoadedMedianMs": 161.40000009536743,"id": "editor-gallery",- "layoutSwitchMedianMs": 67.69999980926514,- "loadMedianMs": 94,- "longestTaskMaxMs": 103,+ "layoutSwitchMedianMs": 88.69999980926514,+ "loadMedianMs": 161.40000009536743,+ "longestTaskMaxMs": 136,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -561,24 +561,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746314,- "otherRawBytes": 135056,- "requestCount": 111,- "scriptRawBytes": 3328252,- "scriptRequestCount": 105,- "totalRawBytes": 3660920+ "otherRawBytes": 135095,+ "requestCount": 113,+ "scriptRawBytes": 3342088,+ "scriptRequestCount": 107,+ "totalRawBytes": 3674795},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753778,- "otherRawBytes": 136407,- "requestCount": 111,- "scriptRawBytes": 3361535,- "scriptRequestCount": 105,- "totalRawBytes": 3697530+ "otherRawBytes": 136446,+ "requestCount": 113,+ "scriptRawBytes": 3375509,+ "scriptRequestCount": 107,+ "totalRawBytes": 3711543},- "routeReadyMedianMs": 1329.5999999046326,+ "routeReadyMedianMs": 1598.4000000953674,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"}@@ -1634,6 +1634,8 @@"source:src/workbench/image-actions/selectedImage.ts","source:src/workbench/image-actions/useDeletionConfirmation.tsx","source:src/workbench/image-actions/useImageActions.ts",+ "source:src/workbench/image-map/api.ts",+ "source:src/workbench/image-map/imageMapStore.ts","source:src/workbench/invocation.ts","source:src/workbench/invocationSubmit.ts","source:src/workbench/launchpad/HelpMenu.tsx",@@ -1772,6 +1774,10 @@"source:src/workbench/widgets/diagnostics/manifest.ts","source:src/workbench/widgets/gallery/manifest.ts","source:src/workbench/widgets/generate/manifest.ts",+ "source:src/workbench/widgets/image-map/ImageMapDataRuntime.tsx",+ "source:src/workbench/widgets/image-map/ImageMapWidgetFooter.tsx",+ "source:src/workbench/widgets/image-map/ImageMapWidgetView.tsx",+ "source:src/workbench/widgets/image-map/implementation.ts","source:src/workbench/widgets/image-map/manifest.ts","source:src/workbench/widgets/layers/controlModelOptions.ts","source:src/workbench/widgets/layers/layerOps.ts",@@ -2569,6 +2575,8 @@"source:src/workbench/image-actions/selectedImage.ts","source:src/workbench/image-actions/useDeletionConfirmation.tsx","source:src/workbench/image-actions/useImageActions.ts",+ "source:src/workbench/image-map/api.ts",+ "source:src/workbench/image-map/imageMapStore.ts","source:src/workbench/invocation.ts","source:src/workbench/invocationSubmit.ts","source:src/workbench/launchpad/HelpMenu.tsx",@@ -2763,6 +2771,10 @@"source:src/workbench/widgets/diagnostics/manifest.ts","source:src/workbench/widgets/gallery/manifest.ts","source:src/workbench/widgets/generate/manifest.ts",+ "source:src/workbench/widgets/image-map/ImageMapDataRuntime.tsx",+ "source:src/workbench/widgets/image-map/ImageMapWidgetFooter.tsx",+ "source:src/workbench/widgets/image-map/ImageMapWidgetView.tsx",+ "source:src/workbench/widgets/image-map/implementation.ts","source:src/workbench/widgets/image-map/manifest.ts","source:src/workbench/widgets/layers/AdjustmentsPopover.tsx","source:src/workbench/widgets/layers/ControlLayerSettings.tsx",diff --git a/invokeai/frontend/webv2/src/workbench/accountOwnedUiStores.test.ts b/invokeai/frontend/webv2/src/workbench/accountOwnedUiStores.test.tsindex 6a491d29c3..fab8fbc43e 100644--- a/invokeai/frontend/webv2/src/workbench/accountOwnedUiStores.test.ts+++ b/invokeai/frontend/webv2/src/workbench/accountOwnedUiStores.test.ts@@ -19,7 +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 },+ indexCounts: { embedded: 1, failed: 0, pending: 0, total: 1 },loadState: 'loaded',});diff --git a/invokeai/frontend/webv2/src/workbench/image-map/events.ts b/invokeai/frontend/webv2/src/workbench/image-map/events.tsindex b3ab910df0..bf4a59137f 100644--- a/invokeai/frontend/webv2/src/workbench/image-map/events.ts+++ b/invokeai/frontend/webv2/src/workbench/image-map/events.ts@@ -11,6 +11,13 @@ export interface ImageIndexStatusEvent {total: number;embedded: number;pending: number;+ /**+ * Images given up on after repeated embedding failures. Excluded from+ * `pending`, so it is the only thing that explains a settled index where+ * `embedded` never reaches `total`. Optional: the backend defaults it to 0,+ * and an older server omits it entirely.+ */+ failed?: number;}/**diff --git a/invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts b/invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.tsindex 885e4ea0d5..f97d4d49d5 100644--- a/invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts+++ b/invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts@@ -20,6 +20,8 @@ export interface ImageIndexCounts {total: number;embedded: number;pending: number;+ /** Given up on after repeated failures; excluded from `pending`. */+ failed: number;}export interface ImageMapSnapshot {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.tsindex 3c0481c7de..f97a889a55 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.test.ts@@ -1,11 +1,14 @@import { beforeEach, describe, expect, it, vi } from 'vitest';const mocks = vi.hoisted(() => ({+ getAuthSession: vi.fn(() => ({ user: null }) as { user: { user_id: string } | null }),onConnectionChange: vi.fn(),refreshImageMapPoints: vi.fn(),socketOn: vi.fn(),}));+vi.mock('@features/identity', () => ({ getAuthSession: mocks.getAuthSession }));+vi.mock('@platform/transport/socketHub', () => ({socketHub: {on: mocks.socketOn,@@ -35,6 +38,7 @@ describe('attachImageMapDataRuntime', () => {mocks.socketOn.mockReset().mockReturnValue(() => {});mocks.onConnectionChange.mockReset().mockReturnValue(() => {});mocks.refreshImageMapPoints.mockReset();+ mocks.getAuthSession.mockReset().mockReturnValue({ user: null });imageMapStore.setSnapshot({ data: null, error: null, indexCounts: null, loadState: 'idle', renderError: null });});@@ -55,9 +59,74 @@ describe('attachImageMapDataRuntime', () => {it('stores index progress counts from status events', () => {const detach = attachImageMapDataRuntime();+ getHandler('image_index_status')({ embedded: 3, failed: 1, pending: 2, total: 5 });++ expect(imageMapStore.getSnapshot().indexCounts).toEqual({ embedded: 3, failed: 1, pending: 2, total: 5 });+ detach();+ });++ it('defaults the given-up count for a server that predates the field', () => {+ const detach = attachImageMapDataRuntime();+getHandler('image_index_status')({ embedded: 3, pending: 2, total: 5 });- expect(imageMapStore.getSnapshot().indexCounts).toEqual({ embedded: 3, pending: 2, total: 5 });+ expect(imageMapStore.getSnapshot().indexCounts?.failed).toBe(0);+ detach();+ });++ it('leaves a failed canvas alone instead of remounting it once per event', () => {+ const detach = attachImageMapDataRuntime();++ // The plot's WebGL init failed; the view is showing that, and every+ // successful refresh would clear it and remount straight into the same+ // failure — once per event for the length of a backfill.+ imageMapStore.patchSnapshot({ loadState: 'loaded', renderError: 'The map failed to render.' });+ getHandler('image_map_projection_ready')({ user_id: 'u1' });+ getHandler('image_index_updated')({ user_id: 'u1' });+ getHandler('image_index_status')({ embedded: 5, pending: 0, total: 5 });+ expect(mocks.refreshImageMapPoints).not.toHaveBeenCalled();++ // The user's own retry still clears it, and refreshes resume.+ imageMapStore.patchSnapshot({ renderError: null });+ getHandler('image_index_updated')({ user_id: 'u1' });+ expect(mocks.refreshImageMapPoints).toHaveBeenCalledTimes(1);++ detach();+ });++ it('does not queue a duplicate fetch for an event during the first load', () => {+ const detach = attachImageMapDataRuntime();++ // `loading` used to pass the guard, so the event set `rerunRequested` and+ // forced a second full point set the moment the first settled.+ imageMapStore.patchSnapshot({ loadState: 'loading' });+ getHandler('image_index_updated')({ user_id: 'u1' });++ expect(mocks.refreshImageMapPoints).not.toHaveBeenCalled();+ detach();+ });++ it('ignores a projection recomputed for a different user', () => {+ const detach = attachImageMapDataRuntime();+ const onReady = getHandler('image_map_projection_ready');++ mocks.getAuthSession.mockReturnValue({ user: { user_id: 'me' } });+ imageMapStore.patchSnapshot({ loadState: 'loaded' });++ // Admins receive every user's projection events, and an admin refetch+ // usually finds its own all-images projection stale and enqueues another+ // full recompute.+ onReady({ user_id: 'someone-else' });+ expect(mocks.refreshImageMapPoints).not.toHaveBeenCalled();++ onReady({ user_id: 'me' });+ expect(mocks.refreshImageMapPoints).toHaveBeenCalledTimes(1);++ // Single-user mode has no session user, so nothing is ever foreign.+ mocks.getAuthSession.mockReturnValue({ user: null });+ onReady({ user_id: 'whoever' });+ expect(mocks.refreshImageMapPoints).toHaveBeenCalledTimes(2);+detach();});diff --git a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.tsx b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.tsxindex b49ccae1c9..bb408f14bf 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.tsx@@ -1,5 +1,6 @@-import type { ImageIndexStatusEvent } from '@workbench/image-map/events';+import type { ImageIndexStatusEvent, ImageMapProjectionReadyEvent } from '@workbench/image-map/events';+import { getAuthSession } from '@features/identity';import { useMountEffect } from '@platform/react/useMountEffect';import { socketHub } from '@platform/transport/socketHub';import { imageMapStore, refreshImageMapPoints } from '@workbench/image-map/imageMapStore';@@ -11,17 +12,50 @@ import { imageMapStore, refreshImageMapPoints } from '@workbench/image-map/image* Nothing fetches until the widget itself has loaded the map once — a user* who never opens the Image Map pays nothing.*/+/**+ * An event naming a user other than the session's. Admins receive index and+ * projection events for every user, and an admin refetch usually finds its own+ * all-images projection stale and enqueues another full recompute — so one+ * user's activity would drive UMAP fits on every admin's client. Unknown on+ * either side is not evidence of a foreign event: single-user mode has no+ * session user at all, and an event without a user id predates the field.+ */+const isForAnotherUser = (userId: unknown): boolean => {+ const sessionUserId = getAuthSession().user?.user_id;++ return typeof userId === 'string' && typeof sessionUserId === 'string' && userId !== sessionUserId;+};+export const attachImageMapDataRuntime = (): (() => void) => {const refreshIfLoaded = () => {- if (imageMapStore.getSnapshot().loadState !== 'idle') {- void refreshImageMapPoints();+ const { loadState, renderError } = imageMapStore.getSnapshot();++ // Only once the widget has actually loaded the map. `loading` used to pass+ // this guard, so an event landing during the first fetch queued a rerun+ // and forced a second full point set the moment it settled.+ if (loadState !== 'loaded' && loadState !== 'error') {+ return;}++ // A failed canvas is not something fresh data can repair, and every+ // successful refresh clears `renderError` — which remounts the plot, fails+ // again, and flickers once per event for the length of a backfill.+ // Clearing it stays what it was designed to be: the user's deliberate retry.+ if (renderError) {+ return;+ }++ 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),+ // The backend routes this to the requesting user's room plus admins, so+ // receipt alone does not mean "my map changed".+ socketHub.on('image_map_projection_ready', (payload: never) => {+ if (!isForAnotherUser((payload as unknown as ImageMapProjectionReadyEvent | undefined)?.user_id)) {+ 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@@ -30,7 +64,12 @@ export const attachImageMapDataRuntime = (): (() => void) => {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 },+ indexCounts: {+ embedded: event.embedded,+ failed: event.failed ?? 0,+ 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 enddiff --git a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsxindex afead044b0..3c85eafc2f 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx@@ -40,6 +40,10 @@ const swallow = (promise: Promise<unknown>): void => {promise.catch(() => {});};+/** Matches the preview's `maxW`/`maxH` (Chakra 40 = 10rem); used to keep it on-screen. */+const HOVER_PREVIEW_MAX_PX = 160;+const HOVER_PREVIEW_OFFSET_PX = 14;+interface HoverPreview {imageName: string;url: string;@@ -128,7 +132,7 @@ const ImageMapPlot = () => {pointsRef.current = points;selectedImageNameRef.current = selectedImageName;}, [points, selectedImageName]);- const [hoverPreview, setHoverPreview] = useState<HoverPreview | null>(null);+ const [pendingHoverPreview, 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.@@ -245,10 +249,13 @@ const ImageMapPlot = () => {return () => {disposed = true;- clearHover();};}, [points, selectImage]);+ // The timer must not outlive the component; the scene effect used to do+ // this, but it reruns on every `points` change.+ useEffect(() => clearHover, []);+// Live gold target on the currently selected gallery image, with a gentle// recenter (zoom width preserved) when it drifts near or beyond an edge.useEffect(() => {@@ -368,6 +375,34 @@ const ImageMapPlot = () => {};}, []);+ // A live refresh can drop the hovered image from the map, which makes the+ // preview stale. Derived rather than cleared from an effect: `points`+ // changes on every socket-driven refresh, so clearing on that dependency+ // would silently cancel hovers on a busy server — and they would not come+ // back, since `Plotly.react` resets hover state and no new `plotly_hover`+ // fires until the pointer moves.+ const hoverPreview =+ pendingHoverPreview && points && !points.some((point) => point.imageName === pendingHoverPreview.imageName)+ ? null+ : pendingHoverPreview;++ // The widget is usually docked in a side rail, so a point near the right or+ // bottom edge would otherwise put a fixed-position preview off-screen, where+ // nothing can scroll it into view. Flip to the other side of the cursor when+ // it does not fit.+ const previewPosition = hoverPreview+ ? {+ left:+ hoverPreview.clientX + HOVER_PREVIEW_OFFSET_PX + HOVER_PREVIEW_MAX_PX > window.innerWidth+ ? Math.max(0, hoverPreview.clientX - HOVER_PREVIEW_OFFSET_PX - HOVER_PREVIEW_MAX_PX)+ : hoverPreview.clientX + HOVER_PREVIEW_OFFSET_PX,+ top:+ hoverPreview.clientY + HOVER_PREVIEW_OFFSET_PX + HOVER_PREVIEW_MAX_PX > window.innerHeight+ ? Math.max(0, hoverPreview.clientY - HOVER_PREVIEW_OFFSET_PX - HOVER_PREVIEW_MAX_PX)+ : hoverPreview.clientY + HOVER_PREVIEW_OFFSET_PX,+ }+ : { left: 0, top: 0 };+return (<Box h="full" minH="0" position="relative" w="full"><Box ref={containerRef} h="full" w="full" />@@ -375,7 +410,7 @@ const ImageMapPlot = () => {<BoxborderColor="border.emphasized"borderWidth="1px"- left={`${hoverPreview.clientX + 14}px`}+ left={`${previewPosition.left}px`}maxH="40"maxW="40"overflow="hidden"@@ -383,13 +418,13 @@ const ImageMapPlot = () => {position="fixed"rounded="md"shadow="lg"- top={`${hoverPreview.clientY + 14}px`}+ top={`${previewPosition.top}px`}zIndex="tooltip"><imgalt={hoverPreview.imageName}src={hoverPreview.url}- style={{ display: 'block', maxHeight: '10rem', maxWidth: '10rem' }}+ style={{ display: 'block', maxHeight: `${HOVER_PREVIEW_MAX_PX}px`, maxWidth: `${HOVER_PREVIEW_MAX_PX}px` }}/></Box>) : null}diff --git a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetFooter.tsx b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetFooter.tsxindex ee80a4f12f..8e582dd30f 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetFooter.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetFooter.tsx@@ -22,6 +22,10 @@ export const ImageMapWidgetFooter = (_props: WidgetViewProps) => {}const indexing = indexCounts && indexCounts.pending > 0;+ // Once the queue drains, images given up on are the only reason the index+ // can settle short of `total` — without saying so the count simply stops+ // below the total with nothing to explain it.+ const skipped = indexCounts && indexCounts.pending === 0 && indexCounts.failed > 0;return (<HStack borderTopWidth="1px" color="fg.muted" fontSize="2xs" gap="2" justify="space-between" px="3" py="1" w="full">@@ -33,6 +37,11 @@ export const ImageMapWidgetFooter = (_props: WidgetViewProps) => {· indexing {indexCounts.embedded}/{indexCounts.total}</Text>) : null}+ {skipped ? (+ <Tooltip content="These images repeatedly failed to embed and were given up on.">+ <Text truncate>· {indexCounts.failed} skipped</Text>+ </Tooltip>+ ) : null}</HStack><Tooltip content="Refresh map"><IconButton aria-label="Refresh map" color="fg.muted" size="2xs" variant="ghost" onClick={handleRefresh}>