From eb166baafe761189d7fee8414056ebe912841505 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Mon, 13 May 2024 11:39:39 +1000 Subject: [PATCH] fix(ui): invoke button shows loading while queueing Make the Invoke button show a loading spinner while queueing. The queue mutations need to be awaited else the `isLoading` state doesn't work as expected. I feel like I should understand why, but I don't... --- .../listenerMiddleware/listeners/enqueueRequestedLinear.ts | 2 +- .../listenerMiddleware/listeners/enqueueRequestedNodes.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedLinear.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedLinear.ts index a3f8f34249..2d267b92b2 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedLinear.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedLinear.ts @@ -32,7 +32,7 @@ export const addEnqueueRequestedLinear = (startAppListening: AppStartListening) }) ); try { - req.unwrap(); + await req.unwrap(); if (shouldShowProgressInViewer) { dispatch(isImageViewerOpenChanged(true)); } diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts index 8d39daaef8..12741c52f5 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts @@ -39,7 +39,11 @@ export const addEnqueueRequestedNodes = (startAppListening: AppStartListening) = fixedCacheKey: 'enqueueBatch', }) ); - req.reset(); + try { + await req.unwrap(); + } finally { + req.reset(); + } }, }); };