diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasStateApiModule.ts b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasStateApiModule.ts index e1b6b6dc1a..929e13be7c 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasStateApiModule.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasStateApiModule.ts @@ -293,6 +293,8 @@ export class CanvasStateApiModule extends CanvasModuleBase { }, }; + let didSuceed = false; + /** * If a timeout is provided, we will cancel the graph if it takes too long - but we need a way to clear the timeout * if the graph completes or errors before the timeout. @@ -344,6 +346,8 @@ export class CanvasStateApiModule extends CanvasModuleBase { return; } + didSuceed = true; + // Ok! resolve(getImageDTOResult.value); }; @@ -434,6 +438,10 @@ export class CanvasStateApiModule extends CanvasModuleBase { if (timeout) { timeoutId = window.setTimeout(() => { + if (didSuceed) { + // If we already succeeded, we don't need to do anything + return; + } this.log.trace('Graph canceled by timeout'); clearListeners(); cancelGraph(); @@ -443,6 +451,10 @@ export class CanvasStateApiModule extends CanvasModuleBase { if (signal) { signal.addEventListener('abort', () => { + if (didSuceed) { + // If we already succeeded, we don't need to do anything + return; + } this.log.trace('Graph canceled by signal'); _clearTimeout(); clearListeners();