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(canvas): clear stale sam session errors
joshistoast7ba03d8f105b
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.test.tsindex 4f96e656e3..7376698515 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.test.ts@@ -138,7 +138,7 @@ describe('createSelectObjectSession', () => {harness.session.update({ autoProcess: false });expect(harness.session.getSnapshot()).toMatchObject({ error: null, status: 'ready' });- expect(snapshots.every(({ error, status }) => status !== 'error' || error !== null)).toBe(true);+ expect(snapshots.every(({ error, status }) => (status === 'error') === (error !== null))).toBe(true);});it('keeps a non-null error whenever processing fails', async () => {@@ -149,6 +149,15 @@ describe('createSelectObjectSession', () => {expect(harness.session.getSnapshot()).toEqual(expect.objectContaining({ error: 'graph failed', status: 'error' }));});+ it('clears a failed process error when controller source invalidation returns the session to ready', async () => {+ const harness = createHarness({ runGraph: vi.fn(() => Promise.reject(new Error('graph failed'))) });+ await expect(harness.session.process()).resolves.toBe('error');++ harness.controller.invalidateSource('p1', layer.id);++ expect(harness.session.getSnapshot()).toMatchObject({ error: null, status: 'ready' });+ });+it('reuses an uploaded export only while its exact guard remains current', async () => {const harness = createHarness();diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.tsindex df49b40009..907e31a65f 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.ts@@ -124,7 +124,11 @@ export const createSelectObjectSession = <T>(options: CreateSelectObjectSessionOconst listeners = new Set<() => void>();const publishState = (next: SelectObjectSessionState<T>): void => {- state = next.status === 'error' && next.error === null ? { ...next, status: 'ready' } : next;+ if (next.status === 'error') {+ state = next.error === null ? { ...next, status: 'ready' } : next;+ } else {+ state = next.error === null ? next : { ...next, error: null };+ }for (const listener of listeners) {try {listener();