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): allow sam retry after invalidation
joshistoast16a5ebb5b3ee
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.test.tsindex 7376698515..16f43d5c7b 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.test.ts@@ -207,6 +207,35 @@ describe('createSelectObjectSession', () => {});+ it('starts an immediate same-input retry after invalidation when old work ignores abort', async () => {+ const older = deferred<{ imageName: string; origin: string }>();+ const newer = deferred<{ imageName: string; origin: string }>();+ const harness = createHarness({+ runGraph: vi+ .fn()+ .mockImplementationOnce(() => older.promise)+ .mockImplementationOnce(() => newer.promise),+ });+ const oldPending = harness.session.process();+ await vi.waitFor(() => expect(harness.deps.runGraph).toHaveBeenCalledOnce());++ harness.controller.invalidateSource('p1', layer.id);+ const newPending = harness.session.process();++ expect(newPending).not.toBe(oldPending);+ await vi.waitFor(() => expect(harness.deps.runGraph).toHaveBeenCalledTimes(2));+ expect(harness.deps.exportLayer).toHaveBeenCalledTimes(2);+ older.resolve({ imageName: 'old.png', origin: 'old' });+ await expect(oldPending).resolves.toBe('stale');+ expect(harness.session.process()).toBe(newPending);++ newer.resolve({ imageName: 'new.png', origin: 'new' });+ await expect(newPending).resolves.toBe('published');+ expect(harness.session.getSnapshot().preview?.image.imageName).toBe('new.png');+ await expect(harness.session.process()).resolves.toBe('deduped');+ expect(harness.deps.runGraph).toHaveBeenCalledTimes(2);+ });+it('deduplicates an identical stable input hash after publication', 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 907e31a65f..7332649bf3 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/selectObjectSession.ts@@ -146,6 +146,11 @@ export const createSelectObjectSession = <T>(options: CreateSelectObjectSessionO};const clearSource = (): void => {+ requestToken += 1;+ sourceController?.abort();+ sourceController = null;+ pendingHash = null;+ pendingProcess = null;source = null;operation = null;operationGuard = null;@@ -166,8 +171,6 @@ export const createSelectObjectSession = <T>(options: CreateSelectObjectSessionOreturn;}if (!startingOperation && operation && deps.controller.getSnapshot().status === 'idle') {- sourceController?.abort();- sourceController = null;clearSource();}});