mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2025-01-07 03:17:05 +08:00
fix(ui): model install error toasts not updating correctly
This commit is contained in:
parent
3e860c8338
commit
d77a6ccd76
@ -7,10 +7,10 @@ import {
|
||||
FormHelperText,
|
||||
FormLabel,
|
||||
Input,
|
||||
useToast,
|
||||
} from '@invoke-ai/ui-library';
|
||||
import { skipToken } from '@reduxjs/toolkit/query';
|
||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||
import { toast } from 'features/toast/toast';
|
||||
import type { ChangeEvent } from 'react';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@ -23,7 +23,6 @@ export const HFToken = () => {
|
||||
const [token, setToken] = useState('');
|
||||
const { currentData } = useGetHFTokenStatusQuery(isHFTokenEnabled ? undefined : skipToken);
|
||||
const [trigger, { isLoading, isUninitialized }] = useSetHFTokenMutation();
|
||||
const toast = useToast();
|
||||
const onChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {
|
||||
setToken(e.target.value);
|
||||
}, []);
|
||||
@ -41,7 +40,7 @@ export const HFToken = () => {
|
||||
});
|
||||
}
|
||||
});
|
||||
}, [t, toast, token, trigger]);
|
||||
}, [t, token, trigger]);
|
||||
|
||||
const error = useMemo(() => {
|
||||
if (!currentData || isUninitialized || isLoading) {
|
||||
|
@ -3,7 +3,7 @@ import { createStandaloneToast, theme, TOAST_OPTIONS } from '@invoke-ai/ui-libra
|
||||
import { nanoid } from 'features/controlLayers/konva/util';
|
||||
import { map } from 'nanostores';
|
||||
|
||||
const toastApi = createStandaloneToast({
|
||||
export const toastApi = createStandaloneToast({
|
||||
theme: theme,
|
||||
defaultOptions: TOAST_OPTIONS.defaultOptions,
|
||||
}).toast;
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { Button, ExternalLink, Spinner, Text, useToast } from '@invoke-ai/ui-library';
|
||||
import { Button, ExternalLink, Spinner, Text } from '@invoke-ai/ui-library';
|
||||
import { skipToken } from '@reduxjs/toolkit/query';
|
||||
import { logger } from 'app/logging/logger';
|
||||
import type { AppDispatch, RootState } from 'app/store/store';
|
||||
import { useAppDispatch } from 'app/store/storeHooks';
|
||||
import { getPrefixedId } from 'features/controlLayers/konva/util';
|
||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||
import { toast } from 'features/toast/toast';
|
||||
import { toast, toastApi } from 'features/toast/toast';
|
||||
import { setActiveTab } from 'features/ui/store/uiSlice';
|
||||
import { t } from 'i18next';
|
||||
import { useCallback } from 'react';
|
||||
@ -151,12 +151,11 @@ const HFUnauthorizedToastDescription = () => {
|
||||
|
||||
const { t } = useTranslation();
|
||||
const dispatch = useAppDispatch();
|
||||
const toast = useToast();
|
||||
|
||||
const onClick = useCallback(() => {
|
||||
dispatch(setActiveTab('models'));
|
||||
toast.close(UNAUTHORIZED_TOAST_ID);
|
||||
}, [dispatch, toast]);
|
||||
toastApi.close(UNAUTHORIZED_TOAST_ID);
|
||||
}, [dispatch]);
|
||||
|
||||
if (!data) {
|
||||
return <Spinner />;
|
||||
|
Loading…
Reference in New Issue
Block a user