mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
reset api state when project changes
This commit is contained in:
parent
a5fe6c8af6
commit
56be24b0e4
@ -18,6 +18,7 @@ import { usePreselectedImage } from '../../features/parameters/hooks/usePreselec
|
||||
import AppErrorBoundaryFallback from './AppErrorBoundaryFallback';
|
||||
import GlobalHotkeys from './GlobalHotkeys';
|
||||
import Toaster from './Toaster';
|
||||
import { api } from '../../services/api';
|
||||
|
||||
const DEFAULT_CONFIG = {};
|
||||
|
||||
@ -28,12 +29,14 @@ interface Props {
|
||||
imageName: string;
|
||||
action: 'sendToImg2Img' | 'sendToCanvas' | 'useAllParameters';
|
||||
};
|
||||
projectId?: string;
|
||||
}
|
||||
|
||||
const App = ({
|
||||
config = DEFAULT_CONFIG,
|
||||
headerComponent,
|
||||
selectedImage,
|
||||
projectId,
|
||||
}: Props) => {
|
||||
const language = useAppSelector(languageSelector);
|
||||
|
||||
@ -50,6 +53,12 @@ const App = ({
|
||||
i18n.changeLanguage(language);
|
||||
}, [language]);
|
||||
|
||||
useEffect(() => {
|
||||
if (projectId) {
|
||||
dispatch(api.util.resetApiState());
|
||||
}
|
||||
}, [projectId, dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
if (size(config)) {
|
||||
logger.info({ config }, 'Received config');
|
||||
|
@ -90,6 +90,7 @@ const InvokeAIUI = ({
|
||||
config={config}
|
||||
headerComponent={headerComponent}
|
||||
selectedImage={selectedImage}
|
||||
projectId={projectId}
|
||||
/>
|
||||
</AppDndContext>
|
||||
</ThemeLocaleProvider>
|
||||
|
Loading…
Reference in New Issue
Block a user