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.

test(canvas): pin auto-process in-flight guard

joshistoast45e23677fc72
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/filterOperationSession.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/filterOperationSession.test.ts
index 421c3a3b2a..3c651d30e6 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/filterOperationSession.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/filterOperationSession.test.ts
@@ -397,4 +397,19 @@ describe('auto-process', () => {
expect(deps.runFilter).toHaveBeenCalledTimes(1);
session.dispose();
});
+
+ it('setAutoProcess(true) does not schedule while a run is in flight', async () => {
+ vi.useFakeTimers();
+ const deps = createDeps();
+ const session = createFilterOperationSession({ deps, guard, initialFilter: layer.filter!, layerType: 'raster' })!;
+
+ const inFlight = session.process();
+ session.setAutoProcess(false);
+ session.setAutoProcess(true);
+ await vi.advanceTimersByTimeAsync(FILTER_AUTO_PROCESS_DEBOUNCE_MS * 3);
+ vi.useRealTimers();
+ await inFlight;
+ expect(deps.runFilter).toHaveBeenCalledTimes(1);
+ session.dispose();
+ });
});