mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
fix(ui): restore dynamic middleware
This commit is contained in:
committed by
Kent Keirsey
parent
591b601fd3
commit
da4aab9233
@@ -22,6 +22,7 @@ import Loading from '../../common/components/Loading/Loading';
|
||||
import AppDndContext from '../../features/dnd/components/AppDndContext';
|
||||
import '../../i18n';
|
||||
import { $socketOptions } from '../hooks/useSocketIO';
|
||||
import { addMiddleware, resetMiddlewares } from 'redux-dynamic-middlewares';
|
||||
|
||||
const App = lazy(() => import('./App'));
|
||||
const ThemeLocaleProvider = lazy(() => import('./ThemeLocaleProvider'));
|
||||
@@ -77,6 +78,19 @@ const InvokeAIUI = ({
|
||||
$queueId.set(queueId);
|
||||
}
|
||||
|
||||
// reset dynamically added middlewares
|
||||
resetMiddlewares();
|
||||
|
||||
// TODO: at this point, after resetting the middleware, we really ought to clean up the socket
|
||||
// stuff by calling `dispatch(socketReset())`. but we cannot dispatch from here as we are
|
||||
// outside the provider. it's not needed until there is the possibility that we will change
|
||||
// the `apiUrl`/`token` dynamically.
|
||||
|
||||
// rebuild socket middleware with token and apiUrl
|
||||
if (middleware && middleware.length > 0) {
|
||||
addMiddleware(...middleware);
|
||||
}
|
||||
|
||||
return () => {
|
||||
// Reset the API client token and base url on unmount
|
||||
$baseUrl.set(undefined);
|
||||
|
||||
Reference in New Issue
Block a user