diff --git a/web/app/components/plugins/plugin-detail-panel/action-list.tsx b/web/app/components/plugins/plugin-detail-panel/action-list.tsx index 02e59a005c..53c97b3a76 100644 --- a/web/app/components/plugins/plugin-detail-panel/action-list.tsx +++ b/web/app/components/plugins/plugin-detail-panel/action-list.tsx @@ -44,7 +44,7 @@ const ActionList = ({ setShowSettingAuth(false) } - const { mutate: updatePermission } = useUpdateProviderCredentials({ + const { mutate: updatePermission, isPending } = useUpdateProviderCredentials({ onSuccess: handleCredentialSettingUpdate, }) @@ -102,6 +102,7 @@ const ActionList = ({ credentials: value, })} onRemove={async () => removePermission(provider.name)} + isSaving={isPending} /> )} diff --git a/web/app/components/tools/setting/build-in/config-credentials.tsx b/web/app/components/tools/setting/build-in/config-credentials.tsx index b82c243c75..01297f3330 100644 --- a/web/app/components/tools/setting/build-in/config-credentials.tsx +++ b/web/app/components/tools/setting/build-in/config-credentials.tsx @@ -20,6 +20,7 @@ type Props = { onSaved: (value: Record) => void isHideRemoveBtn?: boolean onRemove?: () => void + isSaving?: boolean } const ConfigCredential: FC = ({ @@ -28,6 +29,7 @@ const ConfigCredential: FC = ({ onSaved, isHideRemoveBtn, onRemove = () => { }, + isSaving, }) => { const { t } = useTranslation() const language = useLanguage() @@ -54,8 +56,13 @@ const ConfigCredential: FC = ({ } } setIsLoading(true) - await onSaved(tempCredential) - setIsLoading(false) + try { + await onSaved(tempCredential) + setIsLoading(false) + } + finally { + setIsLoading(false) + } } return ( @@ -105,7 +112,7 @@ const ConfigCredential: FC = ({ } < div className='flex space-x-2'> - +