tidy(ui): fix circular dependencies in listeners

This commit is contained in:
psychedelicious 2024-02-27 19:14:49 +11:00 committed by Kent Keirsey
parent 344041fd3a
commit d8e21091e7
55 changed files with 215 additions and 313 deletions

View File

@ -1,78 +1,65 @@
import type { TypedStartListening } from '@reduxjs/toolkit'; import type { TypedStartListening } from '@reduxjs/toolkit';
import { createListenerMiddleware } 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 { 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 { 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 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(); export const listenerMiddleware = createListenerMiddleware();
type AppStartListening = TypedStartListening<RootState, AppDispatch>; export type AppStartListening = TypedStartListening<RootState, AppDispatch>;
export const startAppListening = listenerMiddleware.startListening as AppStartListening; const startAppListening = listenerMiddleware.startListening as AppStartListening;
/** /**
* The RTK listener middleware is a lightweight alternative sagas/observables. * The RTK listener middleware is a lightweight alternative sagas/observables.
@ -81,95 +68,88 @@ export const startAppListening = listenerMiddleware.startListening as AppStartLi
*/ */
// Image uploaded // Image uploaded
addImageUploadedFulfilledListener(); addImageUploadedFulfilledListener(startAppListening);
addImageUploadedRejectedListener();
// Image selected // Image selected
addInitialImageSelectedListener(); addInitialImageSelectedListener(startAppListening);
// Image deleted // Image deleted
addRequestedSingleImageDeletionListener(); addRequestedSingleImageDeletionListener(startAppListening);
addRequestedMultipleImageDeletionListener(); addDeleteBoardAndImagesFulfilledListener(startAppListening);
addImageDeletedPendingListener(); addImageToDeleteSelectedListener(startAppListening);
addImageDeletedFulfilledListener();
addImageDeletedRejectedListener();
addDeleteBoardAndImagesFulfilledListener();
addImageToDeleteSelectedListener();
// Image starred // Image starred
addImagesStarredListener(); addImagesStarredListener(startAppListening);
addImagesUnstarredListener(); addImagesUnstarredListener(startAppListening);
// Gallery // Gallery
addGalleryImageClickedListener(); addGalleryImageClickedListener(startAppListening);
// User Invoked // User Invoked
addEnqueueRequestedCanvasListener(); addEnqueueRequestedCanvasListener(startAppListening);
addEnqueueRequestedNodes(); addEnqueueRequestedNodes(startAppListening);
addEnqueueRequestedLinear(); addEnqueueRequestedLinear(startAppListening);
addAnyEnqueuedListener(); addAnyEnqueuedListener(startAppListening);
addBatchEnqueuedListener(); addBatchEnqueuedListener(startAppListening);
// Canvas actions // Canvas actions
addCanvasSavedToGalleryListener(); addCanvasSavedToGalleryListener(startAppListening);
addCanvasMaskSavedToGalleryListener(); addCanvasMaskSavedToGalleryListener(startAppListening);
addCanvasImageToControlNetListener(); addCanvasImageToControlNetListener(startAppListening);
addCanvasMaskToControlNetListener(); addCanvasMaskToControlNetListener(startAppListening);
addCanvasDownloadedAsImageListener(); addCanvasDownloadedAsImageListener(startAppListening);
addCanvasCopiedToClipboardListener(); addCanvasCopiedToClipboardListener(startAppListening);
addCanvasMergedListener(); addCanvasMergedListener(startAppListening);
addStagingAreaImageSavedListener(); addStagingAreaImageSavedListener(startAppListening);
addCommitStagingAreaImageListener(); addCommitStagingAreaImageListener(startAppListening);
// Socket.IO // Socket.IO
addGeneratorProgressListener(); addGeneratorProgressEventListener(startAppListening);
addGraphExecutionStateCompleteListener(); addGraphExecutionStateCompleteEventListener(startAppListening);
addInvocationCompleteListener(); addInvocationCompleteEventListener(startAppListening);
addInvocationErrorListener(); addInvocationErrorEventListener(startAppListening);
addInvocationStartedListener(); addInvocationStartedEventListener(startAppListening);
addSocketConnectedListener(); addSocketConnectedEventListener(startAppListening);
addSocketDisconnectedListener(); addSocketDisconnectedEventListener(startAppListening);
addSocketSubscribedListener(); addSocketSubscribedEventListener(startAppListening);
addSocketUnsubscribedListener(); addSocketUnsubscribedEventListener(startAppListening);
addModelLoadEventListener(); addModelLoadEventListener(startAppListening);
addModelInstallEventListener(); addModelInstallEventListener(startAppListening);
addSessionRetrievalErrorEventListener(); addSessionRetrievalErrorEventListener(startAppListening);
addInvocationRetrievalErrorEventListener(); addInvocationRetrievalErrorEventListener(startAppListening);
addSocketQueueItemStatusChangedEventListener(); addSocketQueueItemStatusChangedEventListener(startAppListening);
addBulkDownloadListeners(); addBulkDownloadListeners(startAppListening);
// ControlNet // ControlNet
addControlNetImageProcessedListener(); addControlNetImageProcessedListener(startAppListening);
addControlNetAutoProcessListener(); addControlNetAutoProcessListener(startAppListening);
// Boards // Boards
addImageAddedToBoardFulfilledListener(); addImageAddedToBoardFulfilledListener(startAppListening);
addImageAddedToBoardRejectedListener(); addImageRemovedFromBoardFulfilledListener(startAppListening);
addImageRemovedFromBoardFulfilledListener(); addBoardIdSelectedListener(startAppListening);
addImageRemovedFromBoardRejectedListener();
addBoardIdSelectedListener();
// Node schemas // Node schemas
addGetOpenAPISchemaListener(); addGetOpenAPISchemaListener(startAppListening);
// Workflows // Workflows
addWorkflowLoadRequestedListener(); addWorkflowLoadRequestedListener(startAppListening);
addUpdateAllNodesRequestedListener(); addUpdateAllNodesRequestedListener(startAppListening);
// DND // DND
addImageDroppedListener(); addImageDroppedListener(startAppListening);
// Models // Models
addModelSelectedListener(); addModelSelectedListener(startAppListening);
// app startup // app startup
addAppStartedListener(); addAppStartedListener(startAppListening);
addModelsLoadedListener(); addModelsLoadedListener(startAppListening);
addAppConfigReceivedListener(); addAppConfigReceivedListener(startAppListening);
addFirstListImagesListener(); addFirstListImagesListener(startAppListening);
// Ad-hoc upscale workflwo // Ad-hoc upscale workflwo
addUpscaleRequestedListener(); addUpscaleRequestedListener(startAppListening);
// Dynamic prompts // Dynamic prompts
addDynamicPromptsListener(); addDynamicPromptsListener(startAppListening);

View File

@ -1,15 +1,14 @@
import { isAnyOf } from '@reduxjs/toolkit'; import { isAnyOf } from '@reduxjs/toolkit';
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { canvasBatchIdsReset, commitStagingAreaImage, discardStagedImages } from 'features/canvas/store/canvasSlice'; import { canvasBatchIdsReset, commitStagingAreaImage, discardStagedImages } from 'features/canvas/store/canvasSlice';
import { addToast } from 'features/system/store/systemSlice'; import { addToast } from 'features/system/store/systemSlice';
import { t } from 'i18next'; import { t } from 'i18next';
import { queueApi } from 'services/api/endpoints/queue'; import { queueApi } from 'services/api/endpoints/queue';
import { startAppListening } from '..';
const matcher = isAnyOf(commitStagingAreaImage, discardStagedImages); const matcher = isAnyOf(commitStagingAreaImage, discardStagedImages);
export const addCommitStagingAreaImageListener = () => { export const addCommitStagingAreaImageListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
matcher, matcher,
effect: async (_, { dispatch, getState }) => { effect: async (_, { dispatch, getState }) => {

View File

@ -1,12 +1,11 @@
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { imageSelected } from 'features/gallery/store/gallerySlice'; import { imageSelected } from 'features/gallery/store/gallerySlice';
import { IMAGE_CATEGORIES } from 'features/gallery/store/types'; import { IMAGE_CATEGORIES } from 'features/gallery/store/types';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import type { ImageCache } from 'services/api/types'; import type { ImageCache } from 'services/api/types';
import { getListImagesUrl, imagesSelectors } from 'services/api/util'; import { getListImagesUrl, imagesSelectors } from 'services/api/util';
import { startAppListening } from '..'; export const addFirstListImagesListener = (startAppListening: AppStartListening) => {
export const addFirstListImagesListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.listImages.matchFulfilled, matcher: imagesApi.endpoints.listImages.matchFulfilled,
effect: async (action, { dispatch, unsubscribe, cancelActiveListeners }) => { effect: async (action, { dispatch, unsubscribe, cancelActiveListeners }) => {

View File

@ -1,8 +1,7 @@
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { queueApi, selectQueueStatus } from 'services/api/endpoints/queue'; import { queueApi, selectQueueStatus } from 'services/api/endpoints/queue';
import { startAppListening } from '..'; export const addAnyEnqueuedListener = (startAppListening: AppStartListening) => {
export const addAnyEnqueuedListener = () => {
startAppListening({ startAppListening({
matcher: queueApi.endpoints.enqueueBatch.matchFulfilled, matcher: queueApi.endpoints.enqueueBatch.matchFulfilled,
effect: async (_, { dispatch, getState }) => { effect: async (_, { dispatch, getState }) => {

View File

@ -1,10 +1,9 @@
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { setInfillMethod } from 'features/parameters/store/generationSlice'; import { setInfillMethod } from 'features/parameters/store/generationSlice';
import { shouldUseNSFWCheckerChanged, shouldUseWatermarkerChanged } from 'features/system/store/systemSlice'; import { shouldUseNSFWCheckerChanged, shouldUseWatermarkerChanged } from 'features/system/store/systemSlice';
import { appInfoApi } from 'services/api/endpoints/appInfo'; import { appInfoApi } from 'services/api/endpoints/appInfo';
import { startAppListening } from '..'; export const addAppConfigReceivedListener = (startAppListening: AppStartListening) => {
export const addAppConfigReceivedListener = () => {
startAppListening({ startAppListening({
matcher: appInfoApi.endpoints.getAppConfig.matchFulfilled, matcher: appInfoApi.endpoints.getAppConfig.matchFulfilled,
effect: async (action, { getState, dispatch }) => { effect: async (action, { getState, dispatch }) => {

View File

@ -1,10 +1,9 @@
import { createAction } from '@reduxjs/toolkit'; import { createAction } from '@reduxjs/toolkit';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { startAppListening } from '..';
export const appStarted = createAction('app/appStarted'); export const appStarted = createAction('app/appStarted');
export const addAppStartedListener = () => { export const addAppStartedListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: appStarted, actionCreator: appStarted,
effect: async (action, { unsubscribe, cancelActiveListeners }) => { effect: async (action, { unsubscribe, cancelActiveListeners }) => {

View File

@ -1,4 +1,5 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { parseify } from 'common/util/serialize'; import { parseify } from 'common/util/serialize';
import { toast } from 'common/util/toast'; import { toast } from 'common/util/toast';
import { zPydanticValidationError } from 'features/system/store/zodSchemas'; import { zPydanticValidationError } from 'features/system/store/zodSchemas';
@ -6,9 +7,7 @@ import { t } from 'i18next';
import { truncate, upperFirst } from 'lodash-es'; import { truncate, upperFirst } from 'lodash-es';
import { queueApi } from 'services/api/endpoints/queue'; import { queueApi } from 'services/api/endpoints/queue';
import { startAppListening } from '..'; export const addBatchEnqueuedListener = (startAppListening: AppStartListening) => {
export const addBatchEnqueuedListener = () => {
// success // success
startAppListening({ startAppListening({
matcher: queueApi.endpoints.enqueueBatch.matchFulfilled, matcher: queueApi.endpoints.enqueueBatch.matchFulfilled,

View File

@ -1,3 +1,4 @@
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { resetCanvas } from 'features/canvas/store/canvasSlice'; import { resetCanvas } from 'features/canvas/store/canvasSlice';
import { controlAdaptersReset } from 'features/controlAdapters/store/controlAdaptersSlice'; import { controlAdaptersReset } from 'features/controlAdapters/store/controlAdaptersSlice';
import { getImageUsage } from 'features/deleteImageModal/store/selectors'; 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 { clearInitialImage } from 'features/parameters/store/generationSlice';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '..'; export const addDeleteBoardAndImagesFulfilledListener = (startAppListening: AppStartListening) => {
export const addDeleteBoardAndImagesFulfilledListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.deleteBoardAndImages.matchFulfilled, matcher: imagesApi.endpoints.deleteBoardAndImages.matchFulfilled,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,12 +1,11 @@
import { isAnyOf } from '@reduxjs/toolkit'; import { isAnyOf } from '@reduxjs/toolkit';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { boardIdSelected, galleryViewChanged, imageSelected } from 'features/gallery/store/gallerySlice'; import { boardIdSelected, galleryViewChanged, imageSelected } from 'features/gallery/store/gallerySlice';
import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types'; import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { imagesSelectors } from 'services/api/util'; import { imagesSelectors } from 'services/api/util';
import { startAppListening } from '..'; export const addBoardIdSelectedListener = (startAppListening: AppStartListening) => {
export const addBoardIdSelectedListener = () => {
startAppListening({ startAppListening({
matcher: isAnyOf(boardIdSelected, galleryViewChanged), matcher: isAnyOf(boardIdSelected, galleryViewChanged),
effect: async (action, { getState, dispatch, condition, cancelActiveListeners }) => { effect: async (action, { getState, dispatch, condition, cancelActiveListeners }) => {

View File

@ -1,7 +1,7 @@
import type { UseToastOptions } from '@invoke-ai/ui-library'; import type { UseToastOptions } from '@invoke-ai/ui-library';
import { ExternalLink } from '@invoke-ai/ui-library'; import { ExternalLink } from '@invoke-ai/ui-library';
import { logger } from 'app/logging/logger'; 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 { toast } from 'common/util/toast';
import { t } from 'i18next'; import { t } from 'i18next';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
@ -13,7 +13,7 @@ import {
const log = logger('images'); const log = logger('images');
export const addBulkDownloadListeners = () => { export const addBulkDownloadListeners = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.bulkDownloadImages.matchFulfilled, matcher: imagesApi.endpoints.bulkDownloadImages.matchFulfilled,
effect: async (action) => { effect: async (action) => {

View File

@ -1,13 +1,12 @@
import { $logger } from 'app/logging/logger'; import { $logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { canvasCopiedToClipboard } from 'features/canvas/store/actions'; import { canvasCopiedToClipboard } from 'features/canvas/store/actions';
import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob'; import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob';
import { addToast } from 'features/system/store/systemSlice'; import { addToast } from 'features/system/store/systemSlice';
import { copyBlobToClipboard } from 'features/system/util/copyBlobToClipboard'; import { copyBlobToClipboard } from 'features/system/util/copyBlobToClipboard';
import { t } from 'i18next'; import { t } from 'i18next';
import { startAppListening } from '..'; export const addCanvasCopiedToClipboardListener = (startAppListening: AppStartListening) => {
export const addCanvasCopiedToClipboardListener = () => {
startAppListening({ startAppListening({
actionCreator: canvasCopiedToClipboard, actionCreator: canvasCopiedToClipboard,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,13 +1,12 @@
import { $logger } from 'app/logging/logger'; import { $logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { canvasDownloadedAsImage } from 'features/canvas/store/actions'; import { canvasDownloadedAsImage } from 'features/canvas/store/actions';
import { downloadBlob } from 'features/canvas/util/downloadBlob'; import { downloadBlob } from 'features/canvas/util/downloadBlob';
import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob'; import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob';
import { addToast } from 'features/system/store/systemSlice'; import { addToast } from 'features/system/store/systemSlice';
import { t } from 'i18next'; import { t } from 'i18next';
import { startAppListening } from '..'; export const addCanvasDownloadedAsImageListener = (startAppListening: AppStartListening) => {
export const addCanvasDownloadedAsImageListener = () => {
startAppListening({ startAppListening({
actionCreator: canvasDownloadedAsImage, actionCreator: canvasDownloadedAsImage,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,4 +1,5 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { canvasImageToControlAdapter } from 'features/canvas/store/actions'; import { canvasImageToControlAdapter } from 'features/canvas/store/actions';
import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob'; import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob';
import { controlAdapterImageChanged } from 'features/controlAdapters/store/controlAdaptersSlice'; import { controlAdapterImageChanged } from 'features/controlAdapters/store/controlAdaptersSlice';
@ -6,9 +7,7 @@ import { addToast } from 'features/system/store/systemSlice';
import { t } from 'i18next'; import { t } from 'i18next';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '..'; export const addCanvasImageToControlNetListener = (startAppListening: AppStartListening) => {
export const addCanvasImageToControlNetListener = () => {
startAppListening({ startAppListening({
actionCreator: canvasImageToControlAdapter, actionCreator: canvasImageToControlAdapter,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,13 +1,12 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { canvasMaskSavedToGallery } from 'features/canvas/store/actions'; import { canvasMaskSavedToGallery } from 'features/canvas/store/actions';
import { getCanvasData } from 'features/canvas/util/getCanvasData'; import { getCanvasData } from 'features/canvas/util/getCanvasData';
import { addToast } from 'features/system/store/systemSlice'; import { addToast } from 'features/system/store/systemSlice';
import { t } from 'i18next'; import { t } from 'i18next';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '..'; export const addCanvasMaskSavedToGalleryListener = (startAppListening: AppStartListening) => {
export const addCanvasMaskSavedToGalleryListener = () => {
startAppListening({ startAppListening({
actionCreator: canvasMaskSavedToGallery, actionCreator: canvasMaskSavedToGallery,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,4 +1,5 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { canvasMaskToControlAdapter } from 'features/canvas/store/actions'; import { canvasMaskToControlAdapter } from 'features/canvas/store/actions';
import { getCanvasData } from 'features/canvas/util/getCanvasData'; import { getCanvasData } from 'features/canvas/util/getCanvasData';
import { controlAdapterImageChanged } from 'features/controlAdapters/store/controlAdaptersSlice'; import { controlAdapterImageChanged } from 'features/controlAdapters/store/controlAdaptersSlice';
@ -6,9 +7,7 @@ import { addToast } from 'features/system/store/systemSlice';
import { t } from 'i18next'; import { t } from 'i18next';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '..'; export const addCanvasMaskToControlNetListener = (startAppListening: AppStartListening) => {
export const addCanvasMaskToControlNetListener = () => {
startAppListening({ startAppListening({
actionCreator: canvasMaskToControlAdapter, actionCreator: canvasMaskToControlAdapter,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,4 +1,5 @@
import { $logger } from 'app/logging/logger'; import { $logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { canvasMerged } from 'features/canvas/store/actions'; import { canvasMerged } from 'features/canvas/store/actions';
import { $canvasBaseLayer } from 'features/canvas/store/canvasNanostore'; import { $canvasBaseLayer } from 'features/canvas/store/canvasNanostore';
import { setMergedCanvas } from 'features/canvas/store/canvasSlice'; import { setMergedCanvas } from 'features/canvas/store/canvasSlice';
@ -7,9 +8,7 @@ import { addToast } from 'features/system/store/systemSlice';
import { t } from 'i18next'; import { t } from 'i18next';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '..'; export const addCanvasMergedListener = (startAppListening: AppStartListening) => {
export const addCanvasMergedListener = () => {
startAppListening({ startAppListening({
actionCreator: canvasMerged, actionCreator: canvasMerged,
effect: async (action, { dispatch }) => { effect: async (action, { dispatch }) => {

View File

@ -1,13 +1,12 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { canvasSavedToGallery } from 'features/canvas/store/actions'; import { canvasSavedToGallery } from 'features/canvas/store/actions';
import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob'; import { getBaseLayerBlob } from 'features/canvas/util/getBaseLayerBlob';
import { addToast } from 'features/system/store/systemSlice'; import { addToast } from 'features/system/store/systemSlice';
import { t } from 'i18next'; import { t } from 'i18next';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '..'; export const addCanvasSavedToGalleryListener = (startAppListening: AppStartListening) => {
export const addCanvasSavedToGalleryListener = () => {
startAppListening({ startAppListening({
actionCreator: canvasSavedToGallery, actionCreator: canvasSavedToGallery,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,5 +1,6 @@
import type { AnyListenerPredicate } from '@reduxjs/toolkit'; import type { AnyListenerPredicate } from '@reduxjs/toolkit';
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import type { RootState } from 'app/store/store'; import type { RootState } from 'app/store/store';
import { controlAdapterImageProcessed } from 'features/controlAdapters/store/actions'; import { controlAdapterImageProcessed } from 'features/controlAdapters/store/actions';
import { import {
@ -12,8 +13,6 @@ import {
} from 'features/controlAdapters/store/controlAdaptersSlice'; } from 'features/controlAdapters/store/controlAdaptersSlice';
import { isControlNetOrT2IAdapter } from 'features/controlAdapters/store/types'; import { isControlNetOrT2IAdapter } from 'features/controlAdapters/store/types';
import { startAppListening } from '..';
type AnyControlAdapterParamChangeAction = type AnyControlAdapterParamChangeAction =
| ReturnType<typeof controlAdapterProcessorParamsChanged> | ReturnType<typeof controlAdapterProcessorParamsChanged>
| ReturnType<typeof controlAdapterModelChanged> | ReturnType<typeof controlAdapterModelChanged>
@ -67,7 +66,7 @@ const DEBOUNCE_MS = 300;
* *
* The network request is debounced. * The network request is debounced.
*/ */
export const addControlNetAutoProcessListener = () => { export const addControlNetAutoProcessListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
predicate, predicate,
effect: async (action, { dispatch, cancelActiveListeners, delay }) => { effect: async (action, { dispatch, cancelActiveListeners, delay }) => {

View File

@ -1,4 +1,5 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { parseify } from 'common/util/serialize'; import { parseify } from 'common/util/serialize';
import { controlAdapterImageProcessed } from 'features/controlAdapters/store/actions'; import { controlAdapterImageProcessed } from 'features/controlAdapters/store/actions';
import { import {
@ -16,9 +17,7 @@ import { queueApi } from 'services/api/endpoints/queue';
import type { BatchConfig, ImageDTO } from 'services/api/types'; import type { BatchConfig, ImageDTO } from 'services/api/types';
import { socketInvocationComplete } from 'services/events/actions'; import { socketInvocationComplete } from 'services/events/actions';
import { startAppListening } from '..'; export const addControlNetImageProcessedListener = (startAppListening: AppStartListening) => {
export const addControlNetImageProcessedListener = () => {
startAppListening({ startAppListening({
actionCreator: controlAdapterImageProcessed, actionCreator: controlAdapterImageProcessed,
effect: async (action, { dispatch, getState, take }) => { effect: async (action, { dispatch, getState, take }) => {

View File

@ -1,5 +1,6 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import { enqueueRequested } from 'app/store/actions'; import { enqueueRequested } from 'app/store/actions';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import openBase64ImageInTab from 'common/util/openBase64ImageInTab'; import openBase64ImageInTab from 'common/util/openBase64ImageInTab';
import { parseify } from 'common/util/serialize'; import { parseify } from 'common/util/serialize';
import { canvasBatchIdAdded, stagingAreaInitialized } from 'features/canvas/store/canvasSlice'; 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 { queueApi } from 'services/api/endpoints/queue';
import type { ImageDTO } from 'services/api/types'; import type { ImageDTO } from 'services/api/types';
import { startAppListening } from '..';
/** /**
* This listener is responsible invoking the canvas. This involves a number of steps: * 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 * 8. Initialize the staging area if not yet initialized
* 9. Dispatch the sessionReadyToInvoke action to invoke the session * 9. Dispatch the sessionReadyToInvoke action to invoke the session
*/ */
export const addEnqueueRequestedCanvasListener = () => { export const addEnqueueRequestedCanvasListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
predicate: (action): action is ReturnType<typeof enqueueRequested> => predicate: (action): action is ReturnType<typeof enqueueRequested> =>
enqueueRequested.match(action) && action.payload.tabName === 'unifiedCanvas', enqueueRequested.match(action) && action.payload.tabName === 'unifiedCanvas',

View File

@ -1,4 +1,5 @@
import { enqueueRequested } from 'app/store/actions'; import { enqueueRequested } from 'app/store/actions';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { prepareLinearUIBatch } from 'features/nodes/util/graph/buildLinearBatchConfig'; import { prepareLinearUIBatch } from 'features/nodes/util/graph/buildLinearBatchConfig';
import { buildLinearImageToImageGraph } from 'features/nodes/util/graph/buildLinearImageToImageGraph'; import { buildLinearImageToImageGraph } from 'features/nodes/util/graph/buildLinearImageToImageGraph';
import { buildLinearSDXLImageToImageGraph } from 'features/nodes/util/graph/buildLinearSDXLImageToImageGraph'; 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 { buildLinearTextToImageGraph } from 'features/nodes/util/graph/buildLinearTextToImageGraph';
import { queueApi } from 'services/api/endpoints/queue'; import { queueApi } from 'services/api/endpoints/queue';
import { startAppListening } from '..'; export const addEnqueueRequestedLinear = (startAppListening: AppStartListening) => {
export const addEnqueueRequestedLinear = () => {
startAppListening({ startAppListening({
predicate: (action): action is ReturnType<typeof enqueueRequested> => predicate: (action): action is ReturnType<typeof enqueueRequested> =>
enqueueRequested.match(action) && (action.payload.tabName === 'txt2img' || action.payload.tabName === 'img2img'), enqueueRequested.match(action) && (action.payload.tabName === 'txt2img' || action.payload.tabName === 'img2img'),

View File

@ -1,12 +1,11 @@
import { enqueueRequested } from 'app/store/actions'; import { enqueueRequested } from 'app/store/actions';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { buildNodesGraph } from 'features/nodes/util/graph/buildNodesGraph'; import { buildNodesGraph } from 'features/nodes/util/graph/buildNodesGraph';
import { buildWorkflowWithValidation } from 'features/nodes/util/workflow/buildWorkflow'; import { buildWorkflowWithValidation } from 'features/nodes/util/workflow/buildWorkflow';
import { queueApi } from 'services/api/endpoints/queue'; import { queueApi } from 'services/api/endpoints/queue';
import type { BatchConfig } from 'services/api/types'; import type { BatchConfig } from 'services/api/types';
import { startAppListening } from '..'; export const addEnqueueRequestedNodes = (startAppListening: AppStartListening) => {
export const addEnqueueRequestedNodes = () => {
startAppListening({ startAppListening({
predicate: (action): action is ReturnType<typeof enqueueRequested> => predicate: (action): action is ReturnType<typeof enqueueRequested> =>
enqueueRequested.match(action) && action.payload.tabName === 'nodes', enqueueRequested.match(action) && action.payload.tabName === 'nodes',

View File

@ -1,12 +1,11 @@
import { createAction } from '@reduxjs/toolkit'; import { createAction } from '@reduxjs/toolkit';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { selectListImagesQueryArgs } from 'features/gallery/store/gallerySelectors'; import { selectListImagesQueryArgs } from 'features/gallery/store/gallerySelectors';
import { selectionChanged } from 'features/gallery/store/gallerySlice'; import { selectionChanged } from 'features/gallery/store/gallerySlice';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import type { ImageDTO } from 'services/api/types'; import type { ImageDTO } from 'services/api/types';
import { imagesSelectors } from 'services/api/util'; import { imagesSelectors } from 'services/api/util';
import { startAppListening } from '..';
export const galleryImageClicked = createAction<{ export const galleryImageClicked = createAction<{
imageDTO: ImageDTO; imageDTO: ImageDTO;
shiftKey: boolean; shiftKey: boolean;
@ -25,7 +24,7 @@ export const galleryImageClicked = createAction<{
* is much more responsive. * is much more responsive.
*/ */
export const addGalleryImageClickedListener = () => { export const addGalleryImageClickedListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: galleryImageClicked, actionCreator: galleryImageClicked,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,13 +1,12 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { parseify } from 'common/util/serialize'; import { parseify } from 'common/util/serialize';
import { nodeTemplatesBuilt } from 'features/nodes/store/nodesSlice'; import { nodeTemplatesBuilt } from 'features/nodes/store/nodesSlice';
import { parseSchema } from 'features/nodes/util/schema/parseSchema'; import { parseSchema } from 'features/nodes/util/schema/parseSchema';
import { size } from 'lodash-es'; import { size } from 'lodash-es';
import { appInfoApi } from 'services/api/endpoints/appInfo'; import { appInfoApi } from 'services/api/endpoints/appInfo';
import { startAppListening } from '..'; export const addGetOpenAPISchemaListener = (startAppListening: AppStartListening) => {
export const addGetOpenAPISchemaListener = () => {
startAppListening({ startAppListening({
matcher: appInfoApi.endpoints.getOpenAPISchema.matchFulfilled, matcher: appInfoApi.endpoints.getOpenAPISchema.matchFulfilled,
effect: (action, { dispatch, getState }) => { effect: (action, { dispatch, getState }) => {

View File

@ -1,9 +1,8 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '..'; export const addImageAddedToBoardFulfilledListener = (startAppListening: AppStartListening) => {
export const addImageAddedToBoardFulfilledListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.addImageToBoard.matchFulfilled, matcher: imagesApi.endpoints.addImageToBoard.matchFulfilled,
effect: (action) => { effect: (action) => {
@ -15,9 +14,7 @@ export const addImageAddedToBoardFulfilledListener = () => {
log.debug({ board_id, imageDTO }, 'Image added to board'); log.debug({ board_id, imageDTO }, 'Image added to board');
}, },
}); });
};
export const addImageAddedToBoardRejectedListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.addImageToBoard.matchRejected, matcher: imagesApi.endpoints.addImageToBoard.matchRejected,
effect: (action) => { effect: (action) => {

View File

@ -1,4 +1,5 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { resetCanvas } from 'features/canvas/store/canvasSlice'; import { resetCanvas } from 'features/canvas/store/canvasSlice';
import { import {
controlAdapterImageChanged, controlAdapterImageChanged,
@ -19,9 +20,7 @@ import { api } from 'services/api';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { imagesSelectors } from 'services/api/util'; import { imagesSelectors } from 'services/api/util';
import { startAppListening } from '..'; export const addRequestedSingleImageDeletionListener = (startAppListening: AppStartListening) => {
export const addRequestedSingleImageDeletionListener = () => {
startAppListening({ startAppListening({
actionCreator: imageDeletionConfirmed, actionCreator: imageDeletionConfirmed,
effect: async (action, { dispatch, getState, condition }) => { 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({ startAppListening({
actionCreator: imageDeletionConfirmed, actionCreator: imageDeletionConfirmed,
effect: async (action, { dispatch, getState }) => { 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({ startAppListening({
matcher: imagesApi.endpoints.deleteImage.matchPending, matcher: imagesApi.endpoints.deleteImage.matchPending,
effect: () => { effect: () => {
// //
}, },
}); });
};
/**
* Called on successful delete
*/
export const addImageDeletedFulfilledListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.deleteImage.matchFulfilled, matcher: imagesApi.endpoints.deleteImage.matchFulfilled,
effect: (action) => { effect: (action) => {
@ -249,12 +233,7 @@ export const addImageDeletedFulfilledListener = () => {
log.debug({ imageDTO: action.meta.arg.originalArgs }, 'Image deleted'); log.debug({ imageDTO: action.meta.arg.originalArgs }, 'Image deleted');
}, },
}); });
};
/**
* Called on failed delete
*/
export const addImageDeletedRejectedListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.deleteImage.matchRejected, matcher: imagesApi.endpoints.deleteImage.matchRejected,
effect: (action) => { effect: (action) => {

View File

@ -1,5 +1,6 @@
import { createAction } from '@reduxjs/toolkit'; import { createAction } from '@reduxjs/toolkit';
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { parseify } from 'common/util/serialize'; import { parseify } from 'common/util/serialize';
import { setInitialCanvasImage } from 'features/canvas/store/canvasSlice'; import { setInitialCanvasImage } from 'features/canvas/store/canvasSlice';
import { import {
@ -12,14 +13,12 @@ import { fieldImageValueChanged } from 'features/nodes/store/nodesSlice';
import { initialImageChanged, selectOptimalDimension } from 'features/parameters/store/generationSlice'; import { initialImageChanged, selectOptimalDimension } from 'features/parameters/store/generationSlice';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '../';
export const dndDropped = createAction<{ export const dndDropped = createAction<{
overData: TypesafeDroppableData; overData: TypesafeDroppableData;
activeData: TypesafeDraggableData; activeData: TypesafeDraggableData;
}>('dnd/dndDropped'); }>('dnd/dndDropped');
export const addImageDroppedListener = () => { export const addImageDroppedListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: dndDropped, actionCreator: dndDropped,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,9 +1,8 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '..'; export const addImageRemovedFromBoardFulfilledListener = (startAppListening: AppStartListening) => {
export const addImageRemovedFromBoardFulfilledListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.removeImageFromBoard.matchFulfilled, matcher: imagesApi.endpoints.removeImageFromBoard.matchFulfilled,
effect: (action) => { effect: (action) => {
@ -13,9 +12,7 @@ export const addImageRemovedFromBoardFulfilledListener = () => {
log.debug({ imageDTO }, 'Image removed from board'); log.debug({ imageDTO }, 'Image removed from board');
}, },
}); });
};
export const addImageRemovedFromBoardRejectedListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.removeImageFromBoard.matchRejected, matcher: imagesApi.endpoints.removeImageFromBoard.matchRejected,
effect: (action) => { effect: (action) => {

View File

@ -1,10 +1,9 @@
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { imageDeletionConfirmed } from 'features/deleteImageModal/store/actions'; import { imageDeletionConfirmed } from 'features/deleteImageModal/store/actions';
import { selectImageUsage } from 'features/deleteImageModal/store/selectors'; import { selectImageUsage } from 'features/deleteImageModal/store/selectors';
import { imagesToDeleteSelected, isModalOpenChanged } from 'features/deleteImageModal/store/slice'; import { imagesToDeleteSelected, isModalOpenChanged } from 'features/deleteImageModal/store/slice';
import { startAppListening } from '..'; export const addImageToDeleteSelectedListener = (startAppListening: AppStartListening) => {
export const addImageToDeleteSelectedListener = () => {
startAppListening({ startAppListening({
actionCreator: imagesToDeleteSelected, actionCreator: imagesToDeleteSelected,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,5 +1,6 @@
import type { UseToastOptions } from '@invoke-ai/ui-library'; import type { UseToastOptions } from '@invoke-ai/ui-library';
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { setInitialCanvasImage } from 'features/canvas/store/canvasSlice'; import { setInitialCanvasImage } from 'features/canvas/store/canvasSlice';
import { import {
controlAdapterImageChanged, controlAdapterImageChanged,
@ -13,9 +14,7 @@ import { omit } from 'lodash-es';
import { boardsApi } from 'services/api/endpoints/boards'; import { boardsApi } from 'services/api/endpoints/boards';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '..'; export const addImageUploadedFulfilledListener = (startAppListening: AppStartListening) => {
export const addImageUploadedFulfilledListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.uploadImage.matchFulfilled, matcher: imagesApi.endpoints.uploadImage.matchFulfilled,
effect: (action, { dispatch, getState }) => { effect: (action, { dispatch, getState }) => {
@ -133,9 +132,7 @@ export const addImageUploadedFulfilledListener = () => {
} }
}, },
}); });
};
export const addImageUploadedRejectedListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.uploadImage.matchRejected, matcher: imagesApi.endpoints.uploadImage.matchRejected,
effect: (action, { dispatch }) => { effect: (action, { dispatch }) => {

View File

@ -1,10 +1,9 @@
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { selectionChanged } from 'features/gallery/store/gallerySlice'; import { selectionChanged } from 'features/gallery/store/gallerySlice';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import type { ImageDTO } from 'services/api/types'; import type { ImageDTO } from 'services/api/types';
import { startAppListening } from '..'; export const addImagesStarredListener = (startAppListening: AppStartListening) => {
export const addImagesStarredListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.starImages.matchFulfilled, matcher: imagesApi.endpoints.starImages.matchFulfilled,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,10 +1,9 @@
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { selectionChanged } from 'features/gallery/store/gallerySlice'; import { selectionChanged } from 'features/gallery/store/gallerySlice';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import type { ImageDTO } from 'services/api/types'; import type { ImageDTO } from 'services/api/types';
import { startAppListening } from '..'; export const addImagesUnstarredListener = (startAppListening: AppStartListening) => {
export const addImagesUnstarredListener = () => {
startAppListening({ startAppListening({
matcher: imagesApi.endpoints.unstarImages.matchFulfilled, matcher: imagesApi.endpoints.unstarImages.matchFulfilled,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,12 +1,11 @@
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { initialImageSelected } from 'features/parameters/store/actions'; import { initialImageSelected } from 'features/parameters/store/actions';
import { initialImageChanged } from 'features/parameters/store/generationSlice'; import { initialImageChanged } from 'features/parameters/store/generationSlice';
import { addToast } from 'features/system/store/systemSlice'; import { addToast } from 'features/system/store/systemSlice';
import { makeToast } from 'features/system/util/makeToast'; import { makeToast } from 'features/system/util/makeToast';
import { t } from 'i18next'; import { t } from 'i18next';
import { startAppListening } from '..'; export const addInitialImageSelectedListener = (startAppListening: AppStartListening) => {
export const addInitialImageSelectedListener = () => {
startAppListening({ startAppListening({
actionCreator: initialImageSelected, actionCreator: initialImageSelected,
effect: (action, { dispatch }) => { effect: (action, { dispatch }) => {

View File

@ -1,4 +1,5 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { import {
controlAdapterIsEnabledChanged, controlAdapterIsEnabledChanged,
selectControlAdapterAll, selectControlAdapterAll,
@ -12,9 +13,7 @@ import { makeToast } from 'features/system/util/makeToast';
import { t } from 'i18next'; import { t } from 'i18next';
import { forEach } from 'lodash-es'; import { forEach } from 'lodash-es';
import { startAppListening } from '..'; export const addModelSelectedListener = (startAppListening: AppStartListening) => {
export const addModelSelectedListener = () => {
startAppListening({ startAppListening({
actionCreator: modelSelected, actionCreator: modelSelected,
effect: (action, { getState, dispatch }) => { effect: (action, { getState, dispatch }) => {

View File

@ -1,4 +1,5 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { import {
controlAdapterModelCleared, controlAdapterModelCleared,
selectAllControlNets, selectAllControlNets,
@ -13,9 +14,7 @@ import { forEach, some } from 'lodash-es';
import { mainModelsAdapterSelectors, modelsApi, vaeModelsAdapterSelectors } from 'services/api/endpoints/models'; import { mainModelsAdapterSelectors, modelsApi, vaeModelsAdapterSelectors } from 'services/api/endpoints/models';
import type { TypeGuardFor } from 'services/api/types'; import type { TypeGuardFor } from 'services/api/types';
import { startAppListening } from '..'; export const addModelsLoadedListener = (startAppListening: AppStartListening) => {
export const addModelsLoadedListener = () => {
startAppListening({ startAppListening({
predicate: (action): action is TypeGuardFor<typeof modelsApi.endpoints.getMainModels.matchFulfilled> => predicate: (action): action is TypeGuardFor<typeof modelsApi.endpoints.getMainModels.matchFulfilled> =>
modelsApi.endpoints.getMainModels.matchFulfilled(action) && modelsApi.endpoints.getMainModels.matchFulfilled(action) &&

View File

@ -1,4 +1,5 @@
import { isAnyOf } from '@reduxjs/toolkit'; import { isAnyOf } from '@reduxjs/toolkit';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { import {
combinatorialToggled, combinatorialToggled,
isErrorChanged, isErrorChanged,
@ -13,11 +14,9 @@ import { setPositivePrompt } from 'features/parameters/store/generationSlice';
import { utilitiesApi } from 'services/api/endpoints/utilities'; import { utilitiesApi } from 'services/api/endpoints/utilities';
import { socketConnected } from 'services/events/actions'; import { socketConnected } from 'services/events/actions';
import { startAppListening } from '..';
const matcher = isAnyOf(setPositivePrompt, combinatorialToggled, maxPromptsChanged, maxPromptsReset, socketConnected); const matcher = isAnyOf(setPositivePrompt, combinatorialToggled, maxPromptsChanged, maxPromptsReset, socketConnected);
export const addDynamicPromptsListener = () => { export const addDynamicPromptsListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
matcher, matcher,
effect: async (action, { dispatch, getState, cancelActiveListeners, delay }) => { effect: async (action, { dispatch, getState, cancelActiveListeners, delay }) => {

View File

@ -1,4 +1,5 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { $baseUrl } from 'app/store/nanostores/baseUrl'; import { $baseUrl } from 'app/store/nanostores/baseUrl';
import { isEqual } from 'lodash-es'; import { isEqual } from 'lodash-es';
import { atom } from 'nanostores'; import { atom } from 'nanostores';
@ -6,13 +7,11 @@ import { api } from 'services/api';
import { queueApi, selectQueueStatus } from 'services/api/endpoints/queue'; import { queueApi, selectQueueStatus } from 'services/api/endpoints/queue';
import { socketConnected } from 'services/events/actions'; import { socketConnected } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
const $isFirstConnection = atom(true); const $isFirstConnection = atom(true);
export const addSocketConnectedEventListener = () => { export const addSocketConnectedEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketConnected, actionCreator: socketConnected,
effect: async (action, { dispatch, getState, cancelActiveListeners, delay }) => { effect: async (action, { dispatch, getState, cancelActiveListeners, delay }) => {

View File

@ -1,11 +1,10 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { socketDisconnected } from 'services/events/actions'; import { socketDisconnected } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
export const addSocketDisconnectedEventListener = () => { export const addSocketDisconnectedEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketDisconnected, actionCreator: socketDisconnected,
effect: () => { effect: () => {

View File

@ -1,11 +1,10 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { socketGeneratorProgress } from 'services/events/actions'; import { socketGeneratorProgress } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
export const addGeneratorProgressEventListener = () => { export const addGeneratorProgressEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketGeneratorProgress, actionCreator: socketGeneratorProgress,
effect: (action) => { effect: (action) => {

View File

@ -1,11 +1,10 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { socketGraphExecutionStateComplete } from 'services/events/actions'; import { socketGraphExecutionStateComplete } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
export const addGraphExecutionStateCompleteEventListener = () => { export const addGraphExecutionStateCompleteEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketGraphExecutionStateComplete, actionCreator: socketGraphExecutionStateComplete,
effect: (action) => { effect: (action) => {

View File

@ -1,4 +1,5 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { parseify } from 'common/util/serialize'; import { parseify } from 'common/util/serialize';
import { addImageToStagingArea } from 'features/canvas/store/canvasSlice'; import { addImageToStagingArea } from 'features/canvas/store/canvasSlice';
import { boardIdSelected, galleryViewChanged, imageSelected } from 'features/gallery/store/gallerySlice'; 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 { imagesAdapter } from 'services/api/util';
import { socketInvocationComplete } from 'services/events/actions'; 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 // 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 nodeTypeDenylist = ['load_image', 'image'];
const log = logger('socketio'); const log = logger('socketio');
export const addInvocationCompleteEventListener = () => { export const addInvocationCompleteEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketInvocationComplete, actionCreator: socketInvocationComplete,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,11 +1,10 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { socketInvocationError } from 'services/events/actions'; import { socketInvocationError } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
export const addInvocationErrorEventListener = () => { export const addInvocationErrorEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketInvocationError, actionCreator: socketInvocationError,
effect: (action) => { effect: (action) => {

View File

@ -1,11 +1,10 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { socketInvocationRetrievalError } from 'services/events/actions'; import { socketInvocationRetrievalError } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
export const addInvocationRetrievalErrorEventListener = () => { export const addInvocationRetrievalErrorEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketInvocationRetrievalError, actionCreator: socketInvocationRetrievalError,
effect: (action) => { effect: (action) => {

View File

@ -1,11 +1,10 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { socketInvocationStarted } from 'services/events/actions'; import { socketInvocationStarted } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
export const addInvocationStartedEventListener = () => { export const addInvocationStartedEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketInvocationStarted, actionCreator: socketInvocationStarted,
effect: (action) => { effect: (action) => {

View File

@ -1,3 +1,4 @@
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { api } from 'services/api'; import { api } from 'services/api';
import { modelsApi } from 'services/api/endpoints/models'; import { modelsApi } from 'services/api/endpoints/models';
import { import {
@ -6,9 +7,7 @@ import {
socketModelInstallError, socketModelInstallError,
} from 'services/events/actions'; } from 'services/events/actions';
import { startAppListening } from '../..'; export const addModelInstallEventListener = (startAppListening: AppStartListening) => {
export const addModelInstallEventListener = () => {
startAppListening({ startAppListening({
actionCreator: socketModelInstallDownloading, actionCreator: socketModelInstallDownloading,
effect: async (action, { dispatch }) => { effect: async (action, { dispatch }) => {

View File

@ -1,11 +1,10 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { socketModelLoadCompleted, socketModelLoadStarted } from 'services/events/actions'; import { socketModelLoadCompleted, socketModelLoadStarted } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
export const addModelLoadEventListener = () => { export const addModelLoadEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketModelLoadStarted, actionCreator: socketModelLoadStarted,
effect: (action) => { effect: (action) => {

View File

@ -1,12 +1,11 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { queueApi, queueItemsAdapter } from 'services/api/endpoints/queue'; import { queueApi, queueItemsAdapter } from 'services/api/endpoints/queue';
import { socketQueueItemStatusChanged } from 'services/events/actions'; import { socketQueueItemStatusChanged } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
export const addSocketQueueItemStatusChangedEventListener = () => { export const addSocketQueueItemStatusChangedEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketQueueItemStatusChanged, actionCreator: socketQueueItemStatusChanged,
effect: async (action, { dispatch }) => { effect: async (action, { dispatch }) => {

View File

@ -1,11 +1,10 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { socketSessionRetrievalError } from 'services/events/actions'; import { socketSessionRetrievalError } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
export const addSessionRetrievalErrorEventListener = () => { export const addSessionRetrievalErrorEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketSessionRetrievalError, actionCreator: socketSessionRetrievalError,
effect: (action) => { effect: (action) => {

View File

@ -1,11 +1,10 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { socketSubscribedSession } from 'services/events/actions'; import { socketSubscribedSession } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
export const addSocketSubscribedEventListener = () => { export const addSocketSubscribedEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketSubscribedSession, actionCreator: socketSubscribedSession,
effect: (action) => { effect: (action) => {

View File

@ -1,10 +1,9 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { socketUnsubscribedSession } from 'services/events/actions'; import { socketUnsubscribedSession } from 'services/events/actions';
import { startAppListening } from '../..';
const log = logger('socketio'); const log = logger('socketio');
export const addSocketUnsubscribedEventListener = () => { export const addSocketUnsubscribedEventListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: socketUnsubscribedSession, actionCreator: socketUnsubscribedSession,
effect: (action) => { effect: (action) => {

View File

@ -1,11 +1,10 @@
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { stagingAreaImageSaved } from 'features/canvas/store/actions'; import { stagingAreaImageSaved } from 'features/canvas/store/actions';
import { addToast } from 'features/system/store/systemSlice'; import { addToast } from 'features/system/store/systemSlice';
import { t } from 'i18next'; import { t } from 'i18next';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '..'; export const addStagingAreaImageSavedListener = (startAppListening: AppStartListening) => {
export const addStagingAreaImageSavedListener = () => {
startAppListening({ startAppListening({
actionCreator: stagingAreaImageSaved, actionCreator: stagingAreaImageSaved,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,4 +1,5 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { updateAllNodesRequested } from 'features/nodes/store/actions'; import { updateAllNodesRequested } from 'features/nodes/store/actions';
import { nodeReplaced } from 'features/nodes/store/nodesSlice'; import { nodeReplaced } from 'features/nodes/store/nodesSlice';
import { NodeUpdateError } from 'features/nodes/types/error'; 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 { makeToast } from 'features/system/util/makeToast';
import { t } from 'i18next'; import { t } from 'i18next';
import { startAppListening } from '..'; export const addUpdateAllNodesRequestedListener = (startAppListening: AppStartListening) => {
export const addUpdateAllNodesRequestedListener = () => {
startAppListening({ startAppListening({
actionCreator: updateAllNodesRequested, actionCreator: updateAllNodesRequested,
effect: (action, { dispatch, getState }) => { effect: (action, { dispatch, getState }) => {

View File

@ -1,5 +1,6 @@
import { createAction } from '@reduxjs/toolkit'; import { createAction } from '@reduxjs/toolkit';
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { parseify } from 'common/util/serialize'; import { parseify } from 'common/util/serialize';
import { buildAdHocUpscaleGraph } from 'features/nodes/util/graph/buildAdHocUpscaleGraph'; import { buildAdHocUpscaleGraph } from 'features/nodes/util/graph/buildAdHocUpscaleGraph';
import { createIsAllowedToUpscaleSelector } from 'features/parameters/hooks/useIsAllowedToUpscale'; import { createIsAllowedToUpscaleSelector } from 'features/parameters/hooks/useIsAllowedToUpscale';
@ -8,11 +9,9 @@ import { t } from 'i18next';
import { queueApi } from 'services/api/endpoints/queue'; import { queueApi } from 'services/api/endpoints/queue';
import type { BatchConfig, ImageDTO } from 'services/api/types'; import type { BatchConfig, ImageDTO } from 'services/api/types';
import { startAppListening } from '..';
export const upscaleRequested = createAction<{ imageDTO: ImageDTO }>(`upscale/upscaleRequested`); export const upscaleRequested = createAction<{ imageDTO: ImageDTO }>(`upscale/upscaleRequested`);
export const addUpscaleRequestedListener = () => { export const addUpscaleRequestedListener = (startAppListening: AppStartListening) => {
startAppListening({ startAppListening({
actionCreator: upscaleRequested, actionCreator: upscaleRequested,
effect: async (action, { dispatch, getState }) => { effect: async (action, { dispatch, getState }) => {

View File

@ -1,4 +1,5 @@
import { logger } from 'app/logging/logger'; import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { parseify } from 'common/util/serialize'; import { parseify } from 'common/util/serialize';
import { workflowLoaded, workflowLoadRequested } from 'features/nodes/store/actions'; import { workflowLoaded, workflowLoadRequested } from 'features/nodes/store/actions';
import { $flow } from 'features/nodes/store/reactFlowInstance'; import { $flow } from 'features/nodes/store/reactFlowInstance';
@ -10,9 +11,7 @@ import { t } from 'i18next';
import { z } from 'zod'; import { z } from 'zod';
import { fromZodError } from 'zod-validation-error'; import { fromZodError } from 'zod-validation-error';
import { startAppListening } from '..'; export const addWorkflowLoadRequestedListener = (startAppListening: AppStartListening) => {
export const addWorkflowLoadRequestedListener = () => {
startAppListening({ startAppListening({
actionCreator: workflowLoadRequested, actionCreator: workflowLoadRequested,
effect: (action, { dispatch, getState }) => { effect: (action, { dispatch, getState }) => {

View File

@ -572,7 +572,7 @@ export type paths = {
}; };
}; };
export type webhooks = Record<string, never>; type webhooks = Record<string, never>;
export type components = { export type components = {
schemas: { schemas: {
@ -10929,9 +10929,9 @@ export type components = {
pathItems: never; pathItems: never;
}; };
export type $defs = Record<string, never>; type $defs = Record<string, never>;
export type external = Record<string, never>; type external = Record<string, never>;
export type operations = { export type operations = {