Skip to content

Commit d77a6cc

Browse files
psychedelicioushipsterusername
authored andcommitted
fix(ui): model install error toasts not updating correctly
1 parent 3e860c8 commit d77a6cc

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/HuggingFaceFolder/HFToken.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import {
77
FormHelperText,
88
FormLabel,
99
Input,
10-
useToast,
1110
} from '@invoke-ai/ui-library';
1211
import { skipToken } from '@reduxjs/toolkit/query';
1312
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
13+
import { toast } from 'features/toast/toast';
1414
import type { ChangeEvent } from 'react';
1515
import { useCallback, useMemo, useState } from 'react';
1616
import { useTranslation } from 'react-i18next';
@@ -23,7 +23,6 @@ export const HFToken = () => {
2323
const [token, setToken] = useState('');
2424
const { currentData } = useGetHFTokenStatusQuery(isHFTokenEnabled ? undefined : skipToken);
2525
const [trigger, { isLoading, isUninitialized }] = useSetHFTokenMutation();
26-
const toast = useToast();
2726
const onChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {
2827
setToken(e.target.value);
2928
}, []);
@@ -41,7 +40,7 @@ export const HFToken = () => {
4140
});
4241
}
4342
});
44-
}, [t, toast, token, trigger]);
43+
}, [t, token, trigger]);
4544

4645
const error = useMemo(() => {
4746
if (!currentData || isUninitialized || isLoading) {

invokeai/frontend/web/src/features/toast/toast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createStandaloneToast, theme, TOAST_OPTIONS } from '@invoke-ai/ui-libra
33
import { nanoid } from 'features/controlLayers/konva/util';
44
import { map } from 'nanostores';
55

6-
const toastApi = createStandaloneToast({
6+
export const toastApi = createStandaloneToast({
77
theme: theme,
88
defaultOptions: TOAST_OPTIONS.defaultOptions,
99
}).toast;

invokeai/frontend/web/src/services/events/onModelInstallError.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { Button, ExternalLink, Spinner, Text, useToast } from '@invoke-ai/ui-library';
1+
import { Button, ExternalLink, Spinner, Text } from '@invoke-ai/ui-library';
22
import { skipToken } from '@reduxjs/toolkit/query';
33
import { logger } from 'app/logging/logger';
44
import type { AppDispatch, RootState } from 'app/store/store';
55
import { useAppDispatch } from 'app/store/storeHooks';
66
import { getPrefixedId } from 'features/controlLayers/konva/util';
77
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
8-
import { toast } from 'features/toast/toast';
8+
import { toast, toastApi } from 'features/toast/toast';
99
import { setActiveTab } from 'features/ui/store/uiSlice';
1010
import { t } from 'i18next';
1111
import { useCallback } from 'react';
@@ -151,12 +151,11 @@ const HFUnauthorizedToastDescription = () => {
151151

152152
const { t } = useTranslation();
153153
const dispatch = useAppDispatch();
154-
const toast = useToast();
155154

156155
const onClick = useCallback(() => {
157156
dispatch(setActiveTab('models'));
158-
toast.close(UNAUTHORIZED_TOAST_ID);
159-
}, [dispatch, toast]);
157+
toastApi.close(UNAUTHORIZED_TOAST_ID);
158+
}, [dispatch]);
160159

161160
if (!data) {
162161
return <Spinner />;

0 commit comments

Comments
 (0)