reset on unmount

This commit is contained in:
Mary Hipp 2023-08-28 11:03:15 -04:00
parent 56be24b0e4
commit 6233b0d70d
2 changed files with 6 additions and 9 deletions

View File

@ -29,14 +29,12 @@ interface Props {
imageName: string;
action: 'sendToImg2Img' | 'sendToCanvas' | 'useAllParameters';
};
projectId?: string;
}
const App = ({
config = DEFAULT_CONFIG,
headerComponent,
selectedImage,
projectId,
}: Props) => {
const language = useAppSelector(languageSelector);
@ -53,12 +51,6 @@ const App = ({
i18n.changeLanguage(language);
}, [language]);
useEffect(() => {
if (projectId) {
dispatch(api.util.resetApiState());
}
}, [projectId, dispatch]);
useEffect(() => {
if (size(config)) {
logger.info({ config }, 'Received config');
@ -74,6 +66,12 @@ dispatch(api.util.resetApiState());
handlePreselectedImage(selectedImage);
}, [handlePreselectedImage, selectedImage]);
useEffect(() => {
return () => {
dispatch(api.util.resetApiState());
};
});
return (
<ErrorBoundary
onReset={handleReset}

View File

@ -90,7 +90,6 @@ const InvokeAIUI = ({
config={config}
headerComponent={headerComponent}
selectedImage={selectedImage}
projectId={projectId}
/>
</AppDndContext>
</ThemeLocaleProvider>