From d8e21091e7ce8d9607db0f3f847a3ebaeab5a9c4 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 27 Feb 2024 19:14:49 +1100 Subject: [PATCH] tidy(ui): fix circular dependencies in listeners --- .../middleware/listenerMiddleware/index.ts | 232 ++++++++---------- .../addCommitStagingAreaImageListener.ts | 5 +- .../addFirstListImagesListener.ts.ts | 5 +- .../listeners/anyEnqueued.ts | 5 +- .../listeners/appConfigReceived.ts | 5 +- .../listeners/appStarted.ts | 5 +- .../listeners/batchEnqueued.ts | 5 +- .../listeners/boardAndImagesDeleted.ts | 5 +- .../listeners/boardIdSelected.ts | 5 +- .../listeners/bulkDownload.tsx | 4 +- .../listeners/canvasCopiedToClipboard.ts | 5 +- .../listeners/canvasDownloadedAsImage.ts | 5 +- .../listeners/canvasImageToControlNet.ts | 5 +- .../listeners/canvasMaskSavedToGallery.ts | 5 +- .../listeners/canvasMaskToControlNet.ts | 5 +- .../listeners/canvasMerged.ts | 5 +- .../listeners/canvasSavedToGallery.ts | 5 +- .../listeners/controlNetAutoProcess.ts | 5 +- .../listeners/controlNetImageProcessed.ts | 5 +- .../listeners/enqueueRequestedCanvas.ts | 5 +- .../listeners/enqueueRequestedLinear.ts | 5 +- .../listeners/enqueueRequestedNodes.ts | 5 +- .../listeners/galleryImageClicked.ts | 5 +- .../listeners/getOpenAPISchema.ts | 5 +- .../listeners/imageAddedToBoard.ts | 7 +- .../listeners/imageDeleted.ts | 25 +- .../listeners/imageDropped.ts | 5 +- .../listeners/imageRemovedFromBoard.ts | 7 +- .../listeners/imageToDeleteSelected.ts | 5 +- .../listeners/imageUploaded.ts | 7 +- .../listeners/imagesStarred.ts | 5 +- .../listeners/imagesUnstarred.ts | 5 +- .../listeners/initialImageSelected.ts | 5 +- .../listeners/modelSelected.ts | 5 +- .../listeners/modelsLoaded.ts | 5 +- .../listeners/promptChanged.ts | 5 +- .../listeners/socketio/socketConnected.ts | 5 +- .../listeners/socketio/socketDisconnected.ts | 5 +- .../socketio/socketGeneratorProgress.ts | 5 +- .../socketGraphExecutionStateComplete.ts | 5 +- .../socketio/socketInvocationComplete.ts | 5 +- .../socketio/socketInvocationError.ts | 5 +- .../socketInvocationRetrievalError.ts | 5 +- .../socketio/socketInvocationStarted.ts | 5 +- .../listeners/socketio/socketModelInstall.ts | 5 +- .../listeners/socketio/socketModelLoad.ts | 5 +- .../socketio/socketQueueItemStatusChanged.ts | 5 +- .../socketio/socketSessionRetrievalError.ts | 5 +- .../listeners/socketio/socketSubscribed.ts | 5 +- .../listeners/socketio/socketUnsubscribed.ts | 5 +- .../listeners/stagingAreaImageSaved.ts | 5 +- .../listeners/updateAllNodesRequested.ts | 5 +- .../listeners/upscaleRequested.ts | 5 +- .../listeners/workflowLoadRequested.ts | 5 +- .../frontend/web/src/services/api/schema.ts | 6 +- 55 files changed, 215 insertions(+), 313 deletions(-) diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts index bf1cafc866..c5d86a127f 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts @@ -1,78 +1,65 @@ import type { TypedStartListening } from '@reduxjs/toolkit'; import { createListenerMiddleware } from '@reduxjs/toolkit'; +import { addCommitStagingAreaImageListener } from 'app/store/middleware/listenerMiddleware/listeners/addCommitStagingAreaImageListener'; +import { addFirstListImagesListener } from 'app/store/middleware/listenerMiddleware/listeners/addFirstListImagesListener.ts'; +import { addAnyEnqueuedListener } from 'app/store/middleware/listenerMiddleware/listeners/anyEnqueued'; +import { addAppConfigReceivedListener } from 'app/store/middleware/listenerMiddleware/listeners/appConfigReceived'; +import { addAppStartedListener } from 'app/store/middleware/listenerMiddleware/listeners/appStarted'; +import { addBatchEnqueuedListener } from 'app/store/middleware/listenerMiddleware/listeners/batchEnqueued'; +import { addDeleteBoardAndImagesFulfilledListener } from 'app/store/middleware/listenerMiddleware/listeners/boardAndImagesDeleted'; +import { addBoardIdSelectedListener } from 'app/store/middleware/listenerMiddleware/listeners/boardIdSelected'; import { addBulkDownloadListeners } from 'app/store/middleware/listenerMiddleware/listeners/bulkDownload'; +import { addCanvasCopiedToClipboardListener } from 'app/store/middleware/listenerMiddleware/listeners/canvasCopiedToClipboard'; +import { addCanvasDownloadedAsImageListener } from 'app/store/middleware/listenerMiddleware/listeners/canvasDownloadedAsImage'; +import { addCanvasImageToControlNetListener } from 'app/store/middleware/listenerMiddleware/listeners/canvasImageToControlNet'; +import { addCanvasMaskSavedToGalleryListener } from 'app/store/middleware/listenerMiddleware/listeners/canvasMaskSavedToGallery'; +import { addCanvasMaskToControlNetListener } from 'app/store/middleware/listenerMiddleware/listeners/canvasMaskToControlNet'; +import { addCanvasMergedListener } from 'app/store/middleware/listenerMiddleware/listeners/canvasMerged'; +import { addCanvasSavedToGalleryListener } from 'app/store/middleware/listenerMiddleware/listeners/canvasSavedToGallery'; +import { addControlNetAutoProcessListener } from 'app/store/middleware/listenerMiddleware/listeners/controlNetAutoProcess'; +import { addControlNetImageProcessedListener } from 'app/store/middleware/listenerMiddleware/listeners/controlNetImageProcessed'; +import { addEnqueueRequestedCanvasListener } from 'app/store/middleware/listenerMiddleware/listeners/enqueueRequestedCanvas'; +import { addEnqueueRequestedLinear } from 'app/store/middleware/listenerMiddleware/listeners/enqueueRequestedLinear'; +import { addEnqueueRequestedNodes } from 'app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes'; import { addGalleryImageClickedListener } from 'app/store/middleware/listenerMiddleware/listeners/galleryImageClicked'; +import { addGetOpenAPISchemaListener } from 'app/store/middleware/listenerMiddleware/listeners/getOpenAPISchema'; +import { addImageAddedToBoardFulfilledListener } from 'app/store/middleware/listenerMiddleware/listeners/imageAddedToBoard'; +import { addRequestedSingleImageDeletionListener } from 'app/store/middleware/listenerMiddleware/listeners/imageDeleted'; +import { addImageDroppedListener } from 'app/store/middleware/listenerMiddleware/listeners/imageDropped'; +import { addImageRemovedFromBoardFulfilledListener } from 'app/store/middleware/listenerMiddleware/listeners/imageRemovedFromBoard'; +import { addImagesStarredListener } from 'app/store/middleware/listenerMiddleware/listeners/imagesStarred'; +import { addImagesUnstarredListener } from 'app/store/middleware/listenerMiddleware/listeners/imagesUnstarred'; +import { addImageToDeleteSelectedListener } from 'app/store/middleware/listenerMiddleware/listeners/imageToDeleteSelected'; +import { addImageUploadedFulfilledListener } from 'app/store/middleware/listenerMiddleware/listeners/imageUploaded'; +import { addInitialImageSelectedListener } from 'app/store/middleware/listenerMiddleware/listeners/initialImageSelected'; +import { addModelSelectedListener } from 'app/store/middleware/listenerMiddleware/listeners/modelSelected'; +import { addModelsLoadedListener } from 'app/store/middleware/listenerMiddleware/listeners/modelsLoaded'; +import { addDynamicPromptsListener } from 'app/store/middleware/listenerMiddleware/listeners/promptChanged'; +import { addSocketConnectedEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketConnected'; +import { addSocketDisconnectedEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketDisconnected'; +import { addGeneratorProgressEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketGeneratorProgress'; +import { addGraphExecutionStateCompleteEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketGraphExecutionStateComplete'; +import { addInvocationCompleteEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete'; +import { addInvocationErrorEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationError'; +import { addInvocationRetrievalErrorEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationRetrievalError'; +import { addInvocationStartedEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationStarted'; +import { addModelInstallEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketModelInstall'; +import { addModelLoadEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketModelLoad'; +import { addSocketQueueItemStatusChangedEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketQueueItemStatusChanged'; +import { addSessionRetrievalErrorEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketSessionRetrievalError'; +import { addSocketSubscribedEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketSubscribed'; +import { addSocketUnsubscribedEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketUnsubscribed'; +import { addStagingAreaImageSavedListener } from 'app/store/middleware/listenerMiddleware/listeners/stagingAreaImageSaved'; +import { addUpdateAllNodesRequestedListener } from 'app/store/middleware/listenerMiddleware/listeners/updateAllNodesRequested'; +import { addUpscaleRequestedListener } from 'app/store/middleware/listenerMiddleware/listeners/upscaleRequested'; +import { addWorkflowLoadRequestedListener } from 'app/store/middleware/listenerMiddleware/listeners/workflowLoadRequested'; import type { AppDispatch, RootState } from 'app/store/store'; -import { addCommitStagingAreaImageListener } from './listeners/addCommitStagingAreaImageListener'; -import { addFirstListImagesListener } from './listeners/addFirstListImagesListener.ts'; -import { addAnyEnqueuedListener } from './listeners/anyEnqueued'; -import { addAppConfigReceivedListener } from './listeners/appConfigReceived'; -import { addAppStartedListener } from './listeners/appStarted'; -import { addBatchEnqueuedListener } from './listeners/batchEnqueued'; -import { addDeleteBoardAndImagesFulfilledListener } from './listeners/boardAndImagesDeleted'; -import { addBoardIdSelectedListener } from './listeners/boardIdSelected'; -import { addCanvasCopiedToClipboardListener } from './listeners/canvasCopiedToClipboard'; -import { addCanvasDownloadedAsImageListener } from './listeners/canvasDownloadedAsImage'; -import { addCanvasImageToControlNetListener } from './listeners/canvasImageToControlNet'; -import { addCanvasMaskSavedToGalleryListener } from './listeners/canvasMaskSavedToGallery'; -import { addCanvasMaskToControlNetListener } from './listeners/canvasMaskToControlNet'; -import { addCanvasMergedListener } from './listeners/canvasMerged'; -import { addCanvasSavedToGalleryListener } from './listeners/canvasSavedToGallery'; -import { addControlNetAutoProcessListener } from './listeners/controlNetAutoProcess'; -import { addControlNetImageProcessedListener } from './listeners/controlNetImageProcessed'; -import { addEnqueueRequestedCanvasListener } from './listeners/enqueueRequestedCanvas'; -import { addEnqueueRequestedLinear } from './listeners/enqueueRequestedLinear'; -import { addEnqueueRequestedNodes } from './listeners/enqueueRequestedNodes'; -import { addGetOpenAPISchemaListener } from './listeners/getOpenAPISchema'; -import { - addImageAddedToBoardFulfilledListener, - addImageAddedToBoardRejectedListener, -} from './listeners/imageAddedToBoard'; -import { - addImageDeletedFulfilledListener, - addImageDeletedPendingListener, - addImageDeletedRejectedListener, - addRequestedMultipleImageDeletionListener, - addRequestedSingleImageDeletionListener, -} from './listeners/imageDeleted'; -import { addImageDroppedListener } from './listeners/imageDropped'; -import { - addImageRemovedFromBoardFulfilledListener, - addImageRemovedFromBoardRejectedListener, -} from './listeners/imageRemovedFromBoard'; -import { addImagesStarredListener } from './listeners/imagesStarred'; -import { addImagesUnstarredListener } from './listeners/imagesUnstarred'; -import { addImageToDeleteSelectedListener } from './listeners/imageToDeleteSelected'; -import { addImageUploadedFulfilledListener, addImageUploadedRejectedListener } from './listeners/imageUploaded'; -import { addInitialImageSelectedListener } from './listeners/initialImageSelected'; -import { addModelSelectedListener } from './listeners/modelSelected'; -import { addModelsLoadedListener } from './listeners/modelsLoaded'; -import { addDynamicPromptsListener } from './listeners/promptChanged'; -import { addSocketConnectedEventListener as addSocketConnectedListener } from './listeners/socketio/socketConnected'; -import { addSocketDisconnectedEventListener as addSocketDisconnectedListener } from './listeners/socketio/socketDisconnected'; -import { addGeneratorProgressEventListener as addGeneratorProgressListener } from './listeners/socketio/socketGeneratorProgress'; -import { addGraphExecutionStateCompleteEventListener as addGraphExecutionStateCompleteListener } from './listeners/socketio/socketGraphExecutionStateComplete'; -import { addInvocationCompleteEventListener as addInvocationCompleteListener } from './listeners/socketio/socketInvocationComplete'; -import { addInvocationErrorEventListener as addInvocationErrorListener } from './listeners/socketio/socketInvocationError'; -import { addInvocationRetrievalErrorEventListener } from './listeners/socketio/socketInvocationRetrievalError'; -import { addInvocationStartedEventListener as addInvocationStartedListener } from './listeners/socketio/socketInvocationStarted'; -import { addModelInstallEventListener } from './listeners/socketio/socketModelInstall'; -import { addModelLoadEventListener } from './listeners/socketio/socketModelLoad'; -import { addSocketQueueItemStatusChangedEventListener } from './listeners/socketio/socketQueueItemStatusChanged'; -import { addSessionRetrievalErrorEventListener } from './listeners/socketio/socketSessionRetrievalError'; -import { addSocketSubscribedEventListener as addSocketSubscribedListener } from './listeners/socketio/socketSubscribed'; -import { addSocketUnsubscribedEventListener as addSocketUnsubscribedListener } from './listeners/socketio/socketUnsubscribed'; -import { addStagingAreaImageSavedListener } from './listeners/stagingAreaImageSaved'; -import { addUpdateAllNodesRequestedListener } from './listeners/updateAllNodesRequested'; -import { addUpscaleRequestedListener } from './listeners/upscaleRequested'; -import { addWorkflowLoadRequestedListener } from './listeners/workflowLoadRequested'; - export const listenerMiddleware = createListenerMiddleware(); -type AppStartListening = TypedStartListening; +export type AppStartListening = TypedStartListening; -export const startAppListening = listenerMiddleware.startListening as AppStartListening; +const startAppListening = listenerMiddleware.startListening as AppStartListening; /** * The RTK listener middleware is a lightweight alternative sagas/observables. @@ -81,95 +68,88 @@ export const startAppListening = listenerMiddleware.startListening as AppStartLi */ // Image uploaded -addImageUploadedFulfilledListener(); -addImageUploadedRejectedListener(); +addImageUploadedFulfilledListener(startAppListening); // Image selected -addInitialImageSelectedListener(); +addInitialImageSelectedListener(startAppListening); // Image deleted -addRequestedSingleImageDeletionListener(); -addRequestedMultipleImageDeletionListener(); -addImageDeletedPendingListener(); -addImageDeletedFulfilledListener(); -addImageDeletedRejectedListener(); -addDeleteBoardAndImagesFulfilledListener(); -addImageToDeleteSelectedListener(); +addRequestedSingleImageDeletionListener(startAppListening); +addDeleteBoardAndImagesFulfilledListener(startAppListening); +addImageToDeleteSelectedListener(startAppListening); // Image starred -addImagesStarredListener(); -addImagesUnstarredListener(); +addImagesStarredListener(startAppListening); +addImagesUnstarredListener(startAppListening); // Gallery -addGalleryImageClickedListener(); +addGalleryImageClickedListener(startAppListening); // User Invoked -addEnqueueRequestedCanvasListener(); -addEnqueueRequestedNodes(); -addEnqueueRequestedLinear(); -addAnyEnqueuedListener(); -addBatchEnqueuedListener(); +addEnqueueRequestedCanvasListener(startAppListening); +addEnqueueRequestedNodes(startAppListening); +addEnqueueRequestedLinear(startAppListening); +addAnyEnqueuedListener(startAppListening); +addBatchEnqueuedListener(startAppListening); // Canvas actions -addCanvasSavedToGalleryListener(); -addCanvasMaskSavedToGalleryListener(); -addCanvasImageToControlNetListener(); -addCanvasMaskToControlNetListener(); -addCanvasDownloadedAsImageListener(); -addCanvasCopiedToClipboardListener(); -addCanvasMergedListener(); -addStagingAreaImageSavedListener(); -addCommitStagingAreaImageListener(); +addCanvasSavedToGalleryListener(startAppListening); +addCanvasMaskSavedToGalleryListener(startAppListening); +addCanvasImageToControlNetListener(startAppListening); +addCanvasMaskToControlNetListener(startAppListening); +addCanvasDownloadedAsImageListener(startAppListening); +addCanvasCopiedToClipboardListener(startAppListening); +addCanvasMergedListener(startAppListening); +addStagingAreaImageSavedListener(startAppListening); +addCommitStagingAreaImageListener(startAppListening); // Socket.IO -addGeneratorProgressListener(); -addGraphExecutionStateCompleteListener(); -addInvocationCompleteListener(); -addInvocationErrorListener(); -addInvocationStartedListener(); -addSocketConnectedListener(); -addSocketDisconnectedListener(); -addSocketSubscribedListener(); -addSocketUnsubscribedListener(); -addModelLoadEventListener(); -addModelInstallEventListener(); -addSessionRetrievalErrorEventListener(); -addInvocationRetrievalErrorEventListener(); -addSocketQueueItemStatusChangedEventListener(); -addBulkDownloadListeners(); +addGeneratorProgressEventListener(startAppListening); +addGraphExecutionStateCompleteEventListener(startAppListening); +addInvocationCompleteEventListener(startAppListening); +addInvocationErrorEventListener(startAppListening); +addInvocationStartedEventListener(startAppListening); +addSocketConnectedEventListener(startAppListening); +addSocketDisconnectedEventListener(startAppListening); +addSocketSubscribedEventListener(startAppListening); +addSocketUnsubscribedEventListener(startAppListening); +addModelLoadEventListener(startAppListening); +addModelInstallEventListener(startAppListening); +addSessionRetrievalErrorEventListener(startAppListening); +addInvocationRetrievalErrorEventListener(startAppListening); +addSocketQueueItemStatusChangedEventListener(startAppListening); +addBulkDownloadListeners(startAppListening); // ControlNet -addControlNetImageProcessedListener(); -addControlNetAutoProcessListener(); +addControlNetImageProcessedListener(startAppListening); +addControlNetAutoProcessListener(startAppListening); // Boards -addImageAddedToBoardFulfilledListener(); -addImageAddedToBoardRejectedListener(); -addImageRemovedFromBoardFulfilledListener(); -addImageRemovedFromBoardRejectedListener(); -addBoardIdSelectedListener(); +addImageAddedToBoardFulfilledListener(startAppListening); +addImageRemovedFromBoardFulfilledListener(startAppListening); +addBoardIdSelectedListener(startAppListening); // Node schemas -addGetOpenAPISchemaListener(); +addGetOpenAPISchemaListener(startAppListening); // Workflows -addWorkflowLoadRequestedListener(); -addUpdateAllNodesRequestedListener(); +addWorkflowLoadRequestedListener(startAppListening); +addUpdateAllNodesRequestedListener(startAppListening); // DND -addImageDroppedListener(); +addImageDroppedListener(startAppListening); // Models -addModelSelectedListener(); +addModelSelectedListener(startAppListening); // app startup -addAppStartedListener(); -addModelsLoadedListener(); -addAppConfigReceivedListener(); -addFirstListImagesListener(); +addAppStartedListener(startAppListening); +addModelsLoadedListener(startAppListening); +addAppConfigReceivedListener(startAppListening); +addFirstListImagesListener(startAppListening); // Ad-hoc upscale workflwo -addUpscaleRequestedListener(); +addUpscaleRequestedListener(startAppListening); // Dynamic prompts -addDynamicPromptsListener(); +addDynamicPromptsListener(startAppListening); diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addCommitStagingAreaImageListener.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addCommitStagingAreaImageListener.ts index 2c5fbfbbe4..7e6a83e16d 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addCommitStagingAreaImageListener.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addCommitStagingAreaImageListener.ts @@ -1,15 +1,14 @@ import { isAnyOf } from '@reduxjs/toolkit'; import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { canvasBatchIdsReset, commitStagingAreaImage, discardStagedImages } from 'features/canvas/store/canvasSlice'; import { addToast } from 'features/system/store/systemSlice'; import { t } from 'i18next'; import { queueApi } from 'services/api/endpoints/queue'; -import { startAppListening } from '..'; - const matcher = isAnyOf(commitStagingAreaImage, discardStagedImages); -export const addCommitStagingAreaImageListener = () => { +export const addCommitStagingAreaImageListener = (startAppListening: AppStartListening) => { startAppListening({ matcher, effect: async (_, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addFirstListImagesListener.ts.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addFirstListImagesListener.ts.ts index e7597f7ae0..3f831de5c6 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addFirstListImagesListener.ts.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/addFirstListImagesListener.ts.ts @@ -1,12 +1,11 @@ +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { imageSelected } from 'features/gallery/store/gallerySlice'; import { IMAGE_CATEGORIES } from 'features/gallery/store/types'; import { imagesApi } from 'services/api/endpoints/images'; import type { ImageCache } from 'services/api/types'; import { getListImagesUrl, imagesSelectors } from 'services/api/util'; -import { startAppListening } from '..'; - -export const addFirstListImagesListener = () => { +export const addFirstListImagesListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: imagesApi.endpoints.listImages.matchFulfilled, effect: async (action, { dispatch, unsubscribe, cancelActiveListeners }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/anyEnqueued.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/anyEnqueued.ts index e2114769f4..373fa3dd28 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/anyEnqueued.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/anyEnqueued.ts @@ -1,8 +1,7 @@ +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { queueApi, selectQueueStatus } from 'services/api/endpoints/queue'; -import { startAppListening } from '..'; - -export const addAnyEnqueuedListener = () => { +export const addAnyEnqueuedListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: queueApi.endpoints.enqueueBatch.matchFulfilled, effect: async (_, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appConfigReceived.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appConfigReceived.ts index 3fc9cdda44..4ee73af642 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appConfigReceived.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appConfigReceived.ts @@ -1,10 +1,9 @@ +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { setInfillMethod } from 'features/parameters/store/generationSlice'; import { shouldUseNSFWCheckerChanged, shouldUseWatermarkerChanged } from 'features/system/store/systemSlice'; import { appInfoApi } from 'services/api/endpoints/appInfo'; -import { startAppListening } from '..'; - -export const addAppConfigReceivedListener = () => { +export const addAppConfigReceivedListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: appInfoApi.endpoints.getAppConfig.matchFulfilled, effect: async (action, { getState, dispatch }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appStarted.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appStarted.ts index 9cbd1c4aca..729067ee82 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appStarted.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/appStarted.ts @@ -1,10 +1,9 @@ import { createAction } from '@reduxjs/toolkit'; - -import { startAppListening } from '..'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; export const appStarted = createAction('app/appStarted'); -export const addAppStartedListener = () => { +export const addAppStartedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: appStarted, effect: async (action, { unsubscribe, cancelActiveListeners }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/batchEnqueued.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/batchEnqueued.ts index 07a1039bef..68eda997b7 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/batchEnqueued.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/batchEnqueued.ts @@ -1,4 +1,5 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { parseify } from 'common/util/serialize'; import { toast } from 'common/util/toast'; import { zPydanticValidationError } from 'features/system/store/zodSchemas'; @@ -6,9 +7,7 @@ import { t } from 'i18next'; import { truncate, upperFirst } from 'lodash-es'; import { queueApi } from 'services/api/endpoints/queue'; -import { startAppListening } from '..'; - -export const addBatchEnqueuedListener = () => { +export const addBatchEnqueuedListener = (startAppListening: AppStartListening) => { // success startAppListening({ matcher: queueApi.endpoints.enqueueBatch.matchFulfilled, diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardAndImagesDeleted.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardAndImagesDeleted.ts index 2e77896ad3..8e8d3f4b99 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardAndImagesDeleted.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardAndImagesDeleted.ts @@ -1,3 +1,4 @@ +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { resetCanvas } from 'features/canvas/store/canvasSlice'; import { controlAdaptersReset } from 'features/controlAdapters/store/controlAdaptersSlice'; import { getImageUsage } from 'features/deleteImageModal/store/selectors'; @@ -5,9 +6,7 @@ import { nodeEditorReset } from 'features/nodes/store/nodesSlice'; import { clearInitialImage } from 'features/parameters/store/generationSlice'; import { imagesApi } from 'services/api/endpoints/images'; -import { startAppListening } from '..'; - -export const addDeleteBoardAndImagesFulfilledListener = () => { +export const addDeleteBoardAndImagesFulfilledListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: imagesApi.endpoints.deleteBoardAndImages.matchFulfilled, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts index ebcb96d116..2c1aa6ec8b 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts @@ -1,12 +1,11 @@ import { isAnyOf } from '@reduxjs/toolkit'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { boardIdSelected, galleryViewChanged, imageSelected } from 'features/gallery/store/gallerySlice'; import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types'; import { imagesApi } from 'services/api/endpoints/images'; import { imagesSelectors } from 'services/api/util'; -import { startAppListening } from '..'; - -export const addBoardIdSelectedListener = () => { +export const addBoardIdSelectedListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: isAnyOf(boardIdSelected, galleryViewChanged), effect: async (action, { getState, dispatch, condition, cancelActiveListeners }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/bulkDownload.tsx b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/bulkDownload.tsx index fa5c962ff5..38a0fd7911 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/bulkDownload.tsx +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/bulkDownload.tsx @@ -1,7 +1,7 @@ import type { UseToastOptions } from '@invoke-ai/ui-library'; import { ExternalLink } from '@invoke-ai/ui-library'; import { logger } from 'app/logging/logger'; -import { startAppListening } from 'app/store/middleware/listenerMiddleware'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { toast } from 'common/util/toast'; import { t } from 'i18next'; import { imagesApi } from 'services/api/endpoints/images'; @@ -13,7 +13,7 @@ import { const log = logger('images'); -export const addBulkDownloadListeners = () => { +export const addBulkDownloadListeners = (startAppListening: AppStartListening) => { startAppListening({ matcher: imagesApi.endpoints.bulkDownloadImages.matchFulfilled, effect: async (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasCopiedToClipboard.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasCopiedToClipboard.ts index a4ae936ada..e1f4804d56 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasCopiedToClipboard.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasCopiedToClipboard.ts @@ -1,13 +1,12 @@ import { $logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { canvasCopiedToClipboard } from 'features/canvas/store/actions'; import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob'; import { addToast } from 'features/system/store/systemSlice'; import { copyBlobToClipboard } from 'features/system/util/copyBlobToClipboard'; import { t } from 'i18next'; -import { startAppListening } from '..'; - -export const addCanvasCopiedToClipboardListener = () => { +export const addCanvasCopiedToClipboardListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: canvasCopiedToClipboard, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasDownloadedAsImage.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasDownloadedAsImage.ts index af37afa8d5..5b8150bd20 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasDownloadedAsImage.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasDownloadedAsImage.ts @@ -1,13 +1,12 @@ import { $logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { canvasDownloadedAsImage } from 'features/canvas/store/actions'; import { downloadBlob } from 'features/canvas/util/downloadBlob'; import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob'; import { addToast } from 'features/system/store/systemSlice'; import { t } from 'i18next'; -import { startAppListening } from '..'; - -export const addCanvasDownloadedAsImageListener = () => { +export const addCanvasDownloadedAsImageListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: canvasDownloadedAsImage, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasImageToControlNet.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasImageToControlNet.ts index b9b08d2b4e..775a20965d 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasImageToControlNet.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasImageToControlNet.ts @@ -1,4 +1,5 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { canvasImageToControlAdapter } from 'features/canvas/store/actions'; import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob'; import { controlAdapterImageChanged } from 'features/controlAdapters/store/controlAdaptersSlice'; @@ -6,9 +7,7 @@ import { addToast } from 'features/system/store/systemSlice'; import { t } from 'i18next'; import { imagesApi } from 'services/api/endpoints/images'; -import { startAppListening } from '..'; - -export const addCanvasImageToControlNetListener = () => { +export const addCanvasImageToControlNetListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: canvasImageToControlAdapter, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMaskSavedToGallery.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMaskSavedToGallery.ts index d8a3c3827d..af0c3878fc 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMaskSavedToGallery.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMaskSavedToGallery.ts @@ -1,13 +1,12 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { canvasMaskSavedToGallery } from 'features/canvas/store/actions'; import { getCanvasData } from 'features/canvas/util/getCanvasData'; import { addToast } from 'features/system/store/systemSlice'; import { t } from 'i18next'; import { imagesApi } from 'services/api/endpoints/images'; -import { startAppListening } from '..'; - -export const addCanvasMaskSavedToGalleryListener = () => { +export const addCanvasMaskSavedToGalleryListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: canvasMaskSavedToGallery, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMaskToControlNet.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMaskToControlNet.ts index cf1658cb41..4024488566 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMaskToControlNet.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMaskToControlNet.ts @@ -1,4 +1,5 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { canvasMaskToControlAdapter } from 'features/canvas/store/actions'; import { getCanvasData } from 'features/canvas/util/getCanvasData'; import { controlAdapterImageChanged } from 'features/controlAdapters/store/controlAdaptersSlice'; @@ -6,9 +7,7 @@ import { addToast } from 'features/system/store/systemSlice'; import { t } from 'i18next'; import { imagesApi } from 'services/api/endpoints/images'; -import { startAppListening } from '..'; - -export const addCanvasMaskToControlNetListener = () => { +export const addCanvasMaskToControlNetListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: canvasMaskToControlAdapter, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMerged.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMerged.ts index f29a095c1f..71b0e62b44 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMerged.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasMerged.ts @@ -1,4 +1,5 @@ import { $logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { canvasMerged } from 'features/canvas/store/actions'; import { $canvasBaseLayer } from 'features/canvas/store/canvasNanostore'; import { setMergedCanvas } from 'features/canvas/store/canvasSlice'; @@ -7,9 +8,7 @@ import { addToast } from 'features/system/store/systemSlice'; import { t } from 'i18next'; import { imagesApi } from 'services/api/endpoints/images'; -import { startAppListening } from '..'; - -export const addCanvasMergedListener = () => { +export const addCanvasMergedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: canvasMerged, effect: async (action, { dispatch }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasSavedToGallery.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasSavedToGallery.ts index f09cbe12d1..e3ba988886 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasSavedToGallery.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/canvasSavedToGallery.ts @@ -1,13 +1,12 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { canvasSavedToGallery } from 'features/canvas/store/actions'; import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob'; import { addToast } from 'features/system/store/systemSlice'; import { t } from 'i18next'; import { imagesApi } from 'services/api/endpoints/images'; -import { startAppListening } from '..'; - -export const addCanvasSavedToGalleryListener = () => { +export const addCanvasSavedToGalleryListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: canvasSavedToGallery, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetAutoProcess.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetAutoProcess.ts index d194195665..e52df30681 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetAutoProcess.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetAutoProcess.ts @@ -1,5 +1,6 @@ import type { AnyListenerPredicate } from '@reduxjs/toolkit'; import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import type { RootState } from 'app/store/store'; import { controlAdapterImageProcessed } from 'features/controlAdapters/store/actions'; import { @@ -12,8 +13,6 @@ import { } from 'features/controlAdapters/store/controlAdaptersSlice'; import { isControlNetOrT2IAdapter } from 'features/controlAdapters/store/types'; -import { startAppListening } from '..'; - type AnyControlAdapterParamChangeAction = | ReturnType | ReturnType @@ -67,7 +66,7 @@ const DEBOUNCE_MS = 300; * * The network request is debounced. */ -export const addControlNetAutoProcessListener = () => { +export const addControlNetAutoProcessListener = (startAppListening: AppStartListening) => { startAppListening({ predicate, effect: async (action, { dispatch, cancelActiveListeners, delay }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetImageProcessed.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetImageProcessed.ts index 73de931297..0055866aa7 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetImageProcessed.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetImageProcessed.ts @@ -1,4 +1,5 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { parseify } from 'common/util/serialize'; import { controlAdapterImageProcessed } from 'features/controlAdapters/store/actions'; import { @@ -16,9 +17,7 @@ import { queueApi } from 'services/api/endpoints/queue'; import type { BatchConfig, ImageDTO } from 'services/api/types'; import { socketInvocationComplete } from 'services/events/actions'; -import { startAppListening } from '..'; - -export const addControlNetImageProcessedListener = () => { +export const addControlNetImageProcessedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: controlAdapterImageProcessed, effect: async (action, { dispatch, getState, take }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedCanvas.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedCanvas.ts index 7847448d3e..ed1f4fdd98 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedCanvas.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedCanvas.ts @@ -1,5 +1,6 @@ import { logger } from 'app/logging/logger'; import { enqueueRequested } from 'app/store/actions'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import openBase64ImageInTab from 'common/util/openBase64ImageInTab'; import { parseify } from 'common/util/serialize'; import { canvasBatchIdAdded, stagingAreaInitialized } from 'features/canvas/store/canvasSlice'; @@ -13,8 +14,6 @@ import { imagesApi } from 'services/api/endpoints/images'; import { queueApi } from 'services/api/endpoints/queue'; import type { ImageDTO } from 'services/api/types'; -import { startAppListening } from '..'; - /** * This listener is responsible invoking the canvas. This involves a number of steps: * @@ -28,7 +27,7 @@ import { startAppListening } from '..'; * 8. Initialize the staging area if not yet initialized * 9. Dispatch the sessionReadyToInvoke action to invoke the session */ -export const addEnqueueRequestedCanvasListener = () => { +export const addEnqueueRequestedCanvasListener = (startAppListening: AppStartListening) => { startAppListening({ predicate: (action): action is ReturnType => enqueueRequested.match(action) && action.payload.tabName === 'unifiedCanvas', 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 d1cb692c98..337c0f4145 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 @@ -1,4 +1,5 @@ import { enqueueRequested } from 'app/store/actions'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { prepareLinearUIBatch } from 'features/nodes/util/graph/buildLinearBatchConfig'; import { buildLinearImageToImageGraph } from 'features/nodes/util/graph/buildLinearImageToImageGraph'; import { buildLinearSDXLImageToImageGraph } from 'features/nodes/util/graph/buildLinearSDXLImageToImageGraph'; @@ -6,9 +7,7 @@ import { buildLinearSDXLTextToImageGraph } from 'features/nodes/util/graph/build import { buildLinearTextToImageGraph } from 'features/nodes/util/graph/buildLinearTextToImageGraph'; import { queueApi } from 'services/api/endpoints/queue'; -import { startAppListening } from '..'; - -export const addEnqueueRequestedLinear = () => { +export const addEnqueueRequestedLinear = (startAppListening: AppStartListening) => { startAppListening({ predicate: (action): action is ReturnType => enqueueRequested.match(action) && (action.payload.tabName === 'txt2img' || action.payload.tabName === 'img2img'), 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 0ad33057fd..e33f7c964a 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 @@ -1,12 +1,11 @@ import { enqueueRequested } from 'app/store/actions'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { buildNodesGraph } from 'features/nodes/util/graph/buildNodesGraph'; import { buildWorkflowWithValidation } from 'features/nodes/util/workflow/buildWorkflow'; import { queueApi } from 'services/api/endpoints/queue'; import type { BatchConfig } from 'services/api/types'; -import { startAppListening } from '..'; - -export const addEnqueueRequestedNodes = () => { +export const addEnqueueRequestedNodes = (startAppListening: AppStartListening) => { startAppListening({ predicate: (action): action is ReturnType => enqueueRequested.match(action) && action.payload.tabName === 'nodes', diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/galleryImageClicked.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/galleryImageClicked.ts index cc810a2517..67c6d076ee 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/galleryImageClicked.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/galleryImageClicked.ts @@ -1,12 +1,11 @@ import { createAction } from '@reduxjs/toolkit'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { selectListImagesQueryArgs } from 'features/gallery/store/gallerySelectors'; import { selectionChanged } from 'features/gallery/store/gallerySlice'; import { imagesApi } from 'services/api/endpoints/images'; import type { ImageDTO } from 'services/api/types'; import { imagesSelectors } from 'services/api/util'; -import { startAppListening } from '..'; - export const galleryImageClicked = createAction<{ imageDTO: ImageDTO; shiftKey: boolean; @@ -25,7 +24,7 @@ export const galleryImageClicked = createAction<{ * is much more responsive. */ -export const addGalleryImageClickedListener = () => { +export const addGalleryImageClickedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: galleryImageClicked, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/getOpenAPISchema.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/getOpenAPISchema.ts index 88518e2c0b..acb2bdb698 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/getOpenAPISchema.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/getOpenAPISchema.ts @@ -1,13 +1,12 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { parseify } from 'common/util/serialize'; import { nodeTemplatesBuilt } from 'features/nodes/store/nodesSlice'; import { parseSchema } from 'features/nodes/util/schema/parseSchema'; import { size } from 'lodash-es'; import { appInfoApi } from 'services/api/endpoints/appInfo'; -import { startAppListening } from '..'; - -export const addGetOpenAPISchemaListener = () => { +export const addGetOpenAPISchemaListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: appInfoApi.endpoints.getOpenAPISchema.matchFulfilled, effect: (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageAddedToBoard.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageAddedToBoard.ts index 61da8ff669..5412e0f236 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageAddedToBoard.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageAddedToBoard.ts @@ -1,9 +1,8 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { imagesApi } from 'services/api/endpoints/images'; -import { startAppListening } from '..'; - -export const addImageAddedToBoardFulfilledListener = () => { +export const addImageAddedToBoardFulfilledListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: imagesApi.endpoints.addImageToBoard.matchFulfilled, effect: (action) => { @@ -15,9 +14,7 @@ export const addImageAddedToBoardFulfilledListener = () => { log.debug({ board_id, imageDTO }, 'Image added to board'); }, }); -}; -export const addImageAddedToBoardRejectedListener = () => { startAppListening({ matcher: imagesApi.endpoints.addImageToBoard.matchRejected, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDeleted.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDeleted.ts index 1312e54891..9bbbf80263 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDeleted.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDeleted.ts @@ -1,4 +1,5 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { resetCanvas } from 'features/canvas/store/canvasSlice'; import { controlAdapterImageChanged, @@ -19,9 +20,7 @@ import { api } from 'services/api'; import { imagesApi } from 'services/api/endpoints/images'; import { imagesSelectors } from 'services/api/util'; -import { startAppListening } from '..'; - -export const addRequestedSingleImageDeletionListener = () => { +export const addRequestedSingleImageDeletionListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: imageDeletionConfirmed, effect: async (action, { dispatch, getState, condition }) => { @@ -134,12 +133,7 @@ export const addRequestedSingleImageDeletionListener = () => { } }, }); -}; -/** - * Called when the user requests an image deletion - */ -export const addRequestedMultipleImageDeletionListener = () => { startAppListening({ actionCreator: imageDeletionConfirmed, effect: async (action, { dispatch, getState }) => { @@ -224,24 +218,14 @@ export const addRequestedMultipleImageDeletionListener = () => { } }, }); -}; -/** - * Called when the actual delete request is sent to the server - */ -export const addImageDeletedPendingListener = () => { startAppListening({ matcher: imagesApi.endpoints.deleteImage.matchPending, effect: () => { // }, }); -}; -/** - * Called on successful delete - */ -export const addImageDeletedFulfilledListener = () => { startAppListening({ matcher: imagesApi.endpoints.deleteImage.matchFulfilled, effect: (action) => { @@ -249,12 +233,7 @@ export const addImageDeletedFulfilledListener = () => { log.debug({ imageDTO: action.meta.arg.originalArgs }, 'Image deleted'); }, }); -}; -/** - * Called on failed delete - */ -export const addImageDeletedRejectedListener = () => { startAppListening({ matcher: imagesApi.endpoints.deleteImage.matchRejected, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDropped.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDropped.ts index 268aac25d9..5c1f321b64 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDropped.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDropped.ts @@ -1,5 +1,6 @@ import { createAction } from '@reduxjs/toolkit'; import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { parseify } from 'common/util/serialize'; import { setInitialCanvasImage } from 'features/canvas/store/canvasSlice'; import { @@ -12,14 +13,12 @@ import { fieldImageValueChanged } from 'features/nodes/store/nodesSlice'; import { initialImageChanged, selectOptimalDimension } from 'features/parameters/store/generationSlice'; import { imagesApi } from 'services/api/endpoints/images'; -import { startAppListening } from '../'; - export const dndDropped = createAction<{ overData: TypesafeDroppableData; activeData: TypesafeDraggableData; }>('dnd/dndDropped'); -export const addImageDroppedListener = () => { +export const addImageDroppedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: dndDropped, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageRemovedFromBoard.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageRemovedFromBoard.ts index 4c21a750f1..274e4c51c2 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageRemovedFromBoard.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageRemovedFromBoard.ts @@ -1,9 +1,8 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { imagesApi } from 'services/api/endpoints/images'; -import { startAppListening } from '..'; - -export const addImageRemovedFromBoardFulfilledListener = () => { +export const addImageRemovedFromBoardFulfilledListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: imagesApi.endpoints.removeImageFromBoard.matchFulfilled, effect: (action) => { @@ -13,9 +12,7 @@ export const addImageRemovedFromBoardFulfilledListener = () => { log.debug({ imageDTO }, 'Image removed from board'); }, }); -}; -export const addImageRemovedFromBoardRejectedListener = () => { startAppListening({ matcher: imagesApi.endpoints.removeImageFromBoard.matchRejected, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageToDeleteSelected.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageToDeleteSelected.ts index 03921264a2..d20c0c7c23 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageToDeleteSelected.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageToDeleteSelected.ts @@ -1,10 +1,9 @@ +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { imageDeletionConfirmed } from 'features/deleteImageModal/store/actions'; import { selectImageUsage } from 'features/deleteImageModal/store/selectors'; import { imagesToDeleteSelected, isModalOpenChanged } from 'features/deleteImageModal/store/slice'; -import { startAppListening } from '..'; - -export const addImageToDeleteSelectedListener = () => { +export const addImageToDeleteSelectedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: imagesToDeleteSelected, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts index d17727fcdc..2cebf0aef8 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts @@ -1,5 +1,6 @@ import type { UseToastOptions } from '@invoke-ai/ui-library'; import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { setInitialCanvasImage } from 'features/canvas/store/canvasSlice'; import { controlAdapterImageChanged, @@ -13,9 +14,7 @@ import { omit } from 'lodash-es'; import { boardsApi } from 'services/api/endpoints/boards'; import { imagesApi } from 'services/api/endpoints/images'; -import { startAppListening } from '..'; - -export const addImageUploadedFulfilledListener = () => { +export const addImageUploadedFulfilledListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: imagesApi.endpoints.uploadImage.matchFulfilled, effect: (action, { dispatch, getState }) => { @@ -133,9 +132,7 @@ export const addImageUploadedFulfilledListener = () => { } }, }); -}; -export const addImageUploadedRejectedListener = () => { startAppListening({ matcher: imagesApi.endpoints.uploadImage.matchRejected, effect: (action, { dispatch }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesStarred.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesStarred.ts index 064e9876fc..74b36e3297 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesStarred.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesStarred.ts @@ -1,10 +1,9 @@ +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { selectionChanged } from 'features/gallery/store/gallerySlice'; import { imagesApi } from 'services/api/endpoints/images'; import type { ImageDTO } from 'services/api/types'; -import { startAppListening } from '..'; - -export const addImagesStarredListener = () => { +export const addImagesStarredListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: imagesApi.endpoints.starImages.matchFulfilled, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesUnstarred.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesUnstarred.ts index 7174bd066d..ebae7885c1 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesUnstarred.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imagesUnstarred.ts @@ -1,10 +1,9 @@ +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { selectionChanged } from 'features/gallery/store/gallerySlice'; import { imagesApi } from 'services/api/endpoints/images'; import type { ImageDTO } from 'services/api/types'; -import { startAppListening } from '..'; - -export const addImagesUnstarredListener = () => { +export const addImagesUnstarredListener = (startAppListening: AppStartListening) => { startAppListening({ matcher: imagesApi.endpoints.unstarImages.matchFulfilled, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/initialImageSelected.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/initialImageSelected.ts index 93e921e911..735ce8367a 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/initialImageSelected.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/initialImageSelected.ts @@ -1,12 +1,11 @@ +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { initialImageSelected } from 'features/parameters/store/actions'; import { initialImageChanged } from 'features/parameters/store/generationSlice'; import { addToast } from 'features/system/store/systemSlice'; import { makeToast } from 'features/system/util/makeToast'; import { t } from 'i18next'; -import { startAppListening } from '..'; - -export const addInitialImageSelectedListener = () => { +export const addInitialImageSelectedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: initialImageSelected, effect: (action, { dispatch }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts index bbb9485bcf..bc049cf498 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts @@ -1,4 +1,5 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { controlAdapterIsEnabledChanged, selectControlAdapterAll, @@ -12,9 +13,7 @@ import { makeToast } from 'features/system/util/makeToast'; import { t } from 'i18next'; import { forEach } from 'lodash-es'; -import { startAppListening } from '..'; - -export const addModelSelectedListener = () => { +export const addModelSelectedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: modelSelected, effect: (action, { getState, dispatch }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelsLoaded.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelsLoaded.ts index a1bc9856c9..75c6080bf6 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelsLoaded.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelsLoaded.ts @@ -1,4 +1,5 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { controlAdapterModelCleared, selectAllControlNets, @@ -13,9 +14,7 @@ import { forEach, some } from 'lodash-es'; import { mainModelsAdapterSelectors, modelsApi, vaeModelsAdapterSelectors } from 'services/api/endpoints/models'; import type { TypeGuardFor } from 'services/api/types'; -import { startAppListening } from '..'; - -export const addModelsLoadedListener = () => { +export const addModelsLoadedListener = (startAppListening: AppStartListening) => { startAppListening({ predicate: (action): action is TypeGuardFor => modelsApi.endpoints.getMainModels.matchFulfilled(action) && diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/promptChanged.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/promptChanged.ts index bd6cd502f6..b78ddc3f69 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/promptChanged.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/promptChanged.ts @@ -1,4 +1,5 @@ import { isAnyOf } from '@reduxjs/toolkit'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { combinatorialToggled, isErrorChanged, @@ -13,11 +14,9 @@ import { setPositivePrompt } from 'features/parameters/store/generationSlice'; import { utilitiesApi } from 'services/api/endpoints/utilities'; import { socketConnected } from 'services/events/actions'; -import { startAppListening } from '..'; - const matcher = isAnyOf(setPositivePrompt, combinatorialToggled, maxPromptsChanged, maxPromptsReset, socketConnected); -export const addDynamicPromptsListener = () => { +export const addDynamicPromptsListener = (startAppListening: AppStartListening) => { startAppListening({ matcher, effect: async (action, { dispatch, getState, cancelActiveListeners, delay }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketConnected.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketConnected.ts index df0de6bbda..4c76474cdc 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketConnected.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketConnected.ts @@ -1,4 +1,5 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { $baseUrl } from 'app/store/nanostores/baseUrl'; import { isEqual } from 'lodash-es'; import { atom } from 'nanostores'; @@ -6,13 +7,11 @@ import { api } from 'services/api'; import { queueApi, selectQueueStatus } from 'services/api/endpoints/queue'; import { socketConnected } from 'services/events/actions'; -import { startAppListening } from '../..'; - const log = logger('socketio'); const $isFirstConnection = atom(true); -export const addSocketConnectedEventListener = () => { +export const addSocketConnectedEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketConnected, effect: async (action, { dispatch, getState, cancelActiveListeners, delay }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketDisconnected.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketDisconnected.ts index 02d3b77f89..be1a7663b3 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketDisconnected.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketDisconnected.ts @@ -1,11 +1,10 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { socketDisconnected } from 'services/events/actions'; -import { startAppListening } from '../..'; - const log = logger('socketio'); -export const addSocketDisconnectedEventListener = () => { +export const addSocketDisconnectedEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketDisconnected, effect: () => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketGeneratorProgress.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketGeneratorProgress.ts index 0965f41ee1..bb113a09ee 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketGeneratorProgress.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketGeneratorProgress.ts @@ -1,11 +1,10 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { socketGeneratorProgress } from 'services/events/actions'; -import { startAppListening } from '../..'; - const log = logger('socketio'); -export const addGeneratorProgressEventListener = () => { +export const addGeneratorProgressEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketGeneratorProgress, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketGraphExecutionStateComplete.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketGraphExecutionStateComplete.ts index e4f83561c8..5221679232 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketGraphExecutionStateComplete.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketGraphExecutionStateComplete.ts @@ -1,11 +1,10 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { socketGraphExecutionStateComplete } from 'services/events/actions'; -import { startAppListening } from '../..'; - const log = logger('socketio'); -export const addGraphExecutionStateCompleteEventListener = () => { +export const addGraphExecutionStateCompleteEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketGraphExecutionStateComplete, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts index 75fa9e1094..279f9aac5b 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts @@ -1,4 +1,5 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { parseify } from 'common/util/serialize'; import { addImageToStagingArea } from 'features/canvas/store/canvasSlice'; import { boardIdSelected, galleryViewChanged, imageSelected } from 'features/gallery/store/gallerySlice'; @@ -10,14 +11,12 @@ import { imagesApi } from 'services/api/endpoints/images'; import { imagesAdapter } from 'services/api/util'; import { socketInvocationComplete } from 'services/events/actions'; -import { startAppListening } from '../..'; - // These nodes output an image, but do not actually *save* an image, so we don't want to handle the gallery logic on them const nodeTypeDenylist = ['load_image', 'image']; const log = logger('socketio'); -export const addInvocationCompleteEventListener = () => { +export const addInvocationCompleteEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketInvocationComplete, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationError.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationError.ts index dfc1f0dd58..fb898b4c7a 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationError.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationError.ts @@ -1,11 +1,10 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { socketInvocationError } from 'services/events/actions'; -import { startAppListening } from '../..'; - const log = logger('socketio'); -export const addInvocationErrorEventListener = () => { +export const addInvocationErrorEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketInvocationError, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationRetrievalError.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationRetrievalError.ts index f02317c236..44da4c0ddb 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationRetrievalError.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationRetrievalError.ts @@ -1,11 +1,10 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { socketInvocationRetrievalError } from 'services/events/actions'; -import { startAppListening } from '../..'; - const log = logger('socketio'); -export const addInvocationRetrievalErrorEventListener = () => { +export const addInvocationRetrievalErrorEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketInvocationRetrievalError, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationStarted.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationStarted.ts index 12766b2707..baf476a66b 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationStarted.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationStarted.ts @@ -1,11 +1,10 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { socketInvocationStarted } from 'services/events/actions'; -import { startAppListening } from '../..'; - const log = logger('socketio'); -export const addInvocationStartedEventListener = () => { +export const addInvocationStartedEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketInvocationStarted, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketModelInstall.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketModelInstall.ts index 60dc173cb4..9faedc64d7 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketModelInstall.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketModelInstall.ts @@ -1,3 +1,4 @@ +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { api } from 'services/api'; import { modelsApi } from 'services/api/endpoints/models'; import { @@ -6,9 +7,7 @@ import { socketModelInstallError, } from 'services/events/actions'; -import { startAppListening } from '../..'; - -export const addModelInstallEventListener = () => { +export const addModelInstallEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketModelInstallDownloading, effect: async (action, { dispatch }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketModelLoad.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketModelLoad.ts index aa91c69d75..7009baddf2 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketModelLoad.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketModelLoad.ts @@ -1,11 +1,10 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { socketModelLoadCompleted, socketModelLoadStarted } from 'services/events/actions'; -import { startAppListening } from '../..'; - const log = logger('socketio'); -export const addModelLoadEventListener = () => { +export const addModelLoadEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketModelLoadStarted, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketQueueItemStatusChanged.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketQueueItemStatusChanged.ts index bd5471b299..84073bb427 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketQueueItemStatusChanged.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketQueueItemStatusChanged.ts @@ -1,12 +1,11 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { queueApi, queueItemsAdapter } from 'services/api/endpoints/queue'; import { socketQueueItemStatusChanged } from 'services/events/actions'; -import { startAppListening } from '../..'; - const log = logger('socketio'); -export const addSocketQueueItemStatusChangedEventListener = () => { +export const addSocketQueueItemStatusChangedEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketQueueItemStatusChanged, effect: async (action, { dispatch }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketSessionRetrievalError.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketSessionRetrievalError.ts index b655a686de..a1a497dc08 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketSessionRetrievalError.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketSessionRetrievalError.ts @@ -1,11 +1,10 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { socketSessionRetrievalError } from 'services/events/actions'; -import { startAppListening } from '../..'; - const log = logger('socketio'); -export const addSessionRetrievalErrorEventListener = () => { +export const addSessionRetrievalErrorEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketSessionRetrievalError, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketSubscribed.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketSubscribed.ts index df7d5b4e02..48324cb652 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketSubscribed.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketSubscribed.ts @@ -1,11 +1,10 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { socketSubscribedSession } from 'services/events/actions'; -import { startAppListening } from '../..'; - const log = logger('socketio'); -export const addSocketSubscribedEventListener = () => { +export const addSocketSubscribedEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketSubscribedSession, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketUnsubscribed.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketUnsubscribed.ts index 4552fba2c5..7a76a809d6 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketUnsubscribed.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketUnsubscribed.ts @@ -1,10 +1,9 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { socketUnsubscribedSession } from 'services/events/actions'; - -import { startAppListening } from '../..'; const log = logger('socketio'); -export const addSocketUnsubscribedEventListener = () => { +export const addSocketUnsubscribedEventListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: socketUnsubscribedSession, effect: (action) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/stagingAreaImageSaved.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/stagingAreaImageSaved.ts index 8a38be1b77..6816e25bc1 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/stagingAreaImageSaved.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/stagingAreaImageSaved.ts @@ -1,11 +1,10 @@ +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { stagingAreaImageSaved } from 'features/canvas/store/actions'; import { addToast } from 'features/system/store/systemSlice'; import { t } from 'i18next'; import { imagesApi } from 'services/api/endpoints/images'; -import { startAppListening } from '..'; - -export const addStagingAreaImageSavedListener = () => { +export const addStagingAreaImageSavedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: stagingAreaImageSaved, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/updateAllNodesRequested.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/updateAllNodesRequested.ts index ac1298da5b..5ee9de3c11 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/updateAllNodesRequested.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/updateAllNodesRequested.ts @@ -1,4 +1,5 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { updateAllNodesRequested } from 'features/nodes/store/actions'; import { nodeReplaced } from 'features/nodes/store/nodesSlice'; import { NodeUpdateError } from 'features/nodes/types/error'; @@ -8,9 +9,7 @@ import { addToast } from 'features/system/store/systemSlice'; import { makeToast } from 'features/system/util/makeToast'; import { t } from 'i18next'; -import { startAppListening } from '..'; - -export const addUpdateAllNodesRequestedListener = () => { +export const addUpdateAllNodesRequestedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: updateAllNodesRequested, effect: (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts index ab98930179..ff5d5f24be 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts @@ -1,5 +1,6 @@ import { createAction } from '@reduxjs/toolkit'; import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { parseify } from 'common/util/serialize'; import { buildAdHocUpscaleGraph } from 'features/nodes/util/graph/buildAdHocUpscaleGraph'; import { createIsAllowedToUpscaleSelector } from 'features/parameters/hooks/useIsAllowedToUpscale'; @@ -8,11 +9,9 @@ import { t } from 'i18next'; import { queueApi } from 'services/api/endpoints/queue'; import type { BatchConfig, ImageDTO } from 'services/api/types'; -import { startAppListening } from '..'; - export const upscaleRequested = createAction<{ imageDTO: ImageDTO }>(`upscale/upscaleRequested`); -export const addUpscaleRequestedListener = () => { +export const addUpscaleRequestedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: upscaleRequested, effect: async (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/workflowLoadRequested.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/workflowLoadRequested.ts index ad41dc2654..0227597fe9 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/workflowLoadRequested.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/workflowLoadRequested.ts @@ -1,4 +1,5 @@ import { logger } from 'app/logging/logger'; +import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import { parseify } from 'common/util/serialize'; import { workflowLoaded, workflowLoadRequested } from 'features/nodes/store/actions'; import { $flow } from 'features/nodes/store/reactFlowInstance'; @@ -10,9 +11,7 @@ import { t } from 'i18next'; import { z } from 'zod'; import { fromZodError } from 'zod-validation-error'; -import { startAppListening } from '..'; - -export const addWorkflowLoadRequestedListener = () => { +export const addWorkflowLoadRequestedListener = (startAppListening: AppStartListening) => { startAppListening({ actionCreator: workflowLoadRequested, effect: (action, { dispatch, getState }) => { diff --git a/invokeai/frontend/web/src/services/api/schema.ts b/invokeai/frontend/web/src/services/api/schema.ts index 364ad00578..12227d1ae9 100644 --- a/invokeai/frontend/web/src/services/api/schema.ts +++ b/invokeai/frontend/web/src/services/api/schema.ts @@ -572,7 +572,7 @@ export type paths = { }; }; -export type webhooks = Record; +type webhooks = Record; export type components = { schemas: { @@ -10929,9 +10929,9 @@ export type components = { pathItems: never; }; -export type $defs = Record; +type $defs = Record; -export type external = Record; +type external = Record; export type operations = {