Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: reconcile recent images after missed render completion (#8596)
[._.]/ Adam Eivy154f6421e955
diff --git a/client/src/hooks/useImageGenPageRuntime.js b/client/src/hooks/useImageGenPageRuntime.jsindex 1120308a4e..b973305580 100644--- a/client/src/hooks/useImageGenPageRuntime.js+++ b/client/src/hooks/useImageGenPageRuntime.js@@ -216,6 +216,21 @@ export function useImageGenPageRuntime() {() => listMediaJobs({ kind: 'image' }),{ events: IMAGE_QUEUE_EVENTS },);+ const previousQueueRef = useRef(null);+ useEffect(() => {+ if (!queueJobs) return;+ const previous = previousQueueRef.current;+ previousQueueRef.current = queueJobs;+ if (!previous) return;+ const activeIds = new Set(queueJobs+ .filter((job) => job.status === 'queued' || job.status === 'running')+ .map((job) => job.id));+ // Recover gallery output when a terminal event was missed while offline.+ // Compare identities, not just counts: another enqueue can replace a job.+ if (previous.some((job) => ['queued', 'running'].includes(job.status) && !activeIds.has(job.id))) {+ gallery.refreshRecent();+ }+ }, [queueJobs, gallery.refreshRecent]);const pendingQueued = Math.max(0, (queueJobs || []).filter((job) => job.status === 'queued' || job.status === 'running').length - (generating ? 1 : 0));const rememberQueuedJob = (ack) => {diff --git a/client/src/pages/ImageGen.queueEvents.test.jsx b/client/src/pages/ImageGen.queueEvents.test.jsxindex a4ffe00c48..d30b5a2c3a 100644--- a/client/src/pages/ImageGen.queueEvents.test.jsx+++ b/client/src/pages/ImageGen.queueEvents.test.jsx@@ -59,8 +59,10 @@ describe('Image Gen queue events', () => {await act(async () => { await vi.advanceTimersByTimeAsync(16_000); });expect(state.listMediaJobs).toHaveBeenCalledTimes(2);state.listMediaJobs.mockResolvedValue([]);+ const galleryReads = state.listImageGalleryPage.mock.calls.length;await emit('connect');expect(state.listMediaJobs).toHaveBeenCalledTimes(3);+ expect(state.listImageGalleryPage.mock.calls.length).toBeGreaterThan(galleryReads);expect(screen.queryByText('+1 queued')).not.toBeInTheDocument();const visibility = vi.spyOn(document, 'visibilityState', 'get');