From cd55c23713aa8194a87bda33d2ee5de10f15ec93 Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Wed, 13 Mar 2024 13:19:19 -0400 Subject: [PATCH] initiate TI model query when socket connects so user doesnt have to wait when opening prompt trigger phrases --- .../listenerMiddleware/listeners/socketio/socketConnected.ts | 4 ++++ 1 file changed, 4 insertions(+) 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 4c76474cdc..daae46542f 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 @@ -4,6 +4,7 @@ import { $baseUrl } from 'app/store/nanostores/baseUrl'; import { isEqual } from 'lodash-es'; import { atom } from 'nanostores'; import { api } from 'services/api'; +import { modelsApi } from 'services/api/endpoints/models'; import { queueApi, selectQueueStatus } from 'services/api/endpoints/queue'; import { socketConnected } from 'services/events/actions'; @@ -17,6 +18,9 @@ export const addSocketConnectedEventListener = (startAppListening: AppStartListe effect: async (action, { dispatch, getState, cancelActiveListeners, delay }) => { log.debug('Connected'); + // query TIs so they are ready if user opens trigger phrases + dispatch(modelsApi.endpoints.getTextualInversionModels.initiate()); + /** * The rest of this listener has recovery logic for when the socket disconnects and reconnects. *