mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): add loading state to button when creating or updating a style preset
This commit is contained in:
parent
e85f221aca
commit
a6f6d5c400
@ -30,8 +30,8 @@ export const StylePresetForm = ({
|
|||||||
updatingStylePresetId: string | null;
|
updatingStylePresetId: string | null;
|
||||||
formData: StylePresetFormData | null;
|
formData: StylePresetFormData | null;
|
||||||
}) => {
|
}) => {
|
||||||
const [createStylePreset] = useCreateStylePresetMutation();
|
const [createStylePreset, { isLoading: isCreating }] = useCreateStylePresetMutation();
|
||||||
const [updateStylePreset] = useUpdateStylePresetMutation();
|
const [updateStylePreset, { isLoading: isUpdating }] = useUpdateStylePresetMutation();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const allowPrivateStylePresets = useAppSelector((s) => s.config.allowPrivateStylePresets);
|
const allowPrivateStylePresets = useAppSelector((s) => s.config.allowPrivateStylePresets);
|
||||||
|
|
||||||
@ -109,7 +109,11 @@ export const StylePresetForm = ({
|
|||||||
|
|
||||||
<Flex justifyContent="space-between" alignItems="flex-end" gap={10}>
|
<Flex justifyContent="space-between" alignItems="flex-end" gap={10}>
|
||||||
{allowPrivateStylePresets ? <StylePresetTypeField control={control} name="type" /> : <Spacer />}
|
{allowPrivateStylePresets ? <StylePresetTypeField control={control} name="type" /> : <Spacer />}
|
||||||
<Button onClick={handleSubmit(handleClickSave)} isDisabled={!formState.isValid}>
|
<Button
|
||||||
|
onClick={handleSubmit(handleClickSave)}
|
||||||
|
isDisabled={!formState.isValid}
|
||||||
|
isLoading={isCreating || isUpdating}
|
||||||
|
>
|
||||||
{t('common.save')}
|
{t('common.save')}
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
Loading…
Reference in New Issue
Block a user