diff --git a/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx b/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx index 4de5110e65..295fc4fa9d 100644 --- a/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx +++ b/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx @@ -12,12 +12,14 @@ export type AddApiKeyButtonProps = { buttonVariant?: ButtonProps['variant'] buttonText?: string disabled?: boolean + onUpdate?: () => void } const AddApiKeyButton = ({ pluginPayload, buttonVariant = 'secondary-accent', buttonText = 'use api key', disabled, + onUpdate, }: AddApiKeyButtonProps) => { const [isApiKeyModalOpen, setIsApiKeyModalOpen] = useState(false) @@ -36,6 +38,7 @@ const AddApiKeyButton = ({ setIsApiKeyModalOpen(false)} + onUpdate={onUpdate} /> ) } diff --git a/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx b/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx index f9061a6045..5cb474f1bb 100644 --- a/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx +++ b/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx @@ -21,7 +21,6 @@ import Badge from '@/app/components/base/badge' import { useGetPluginOAuthClientSchemaHook, useGetPluginOAuthUrlHook, - useInvalidPluginCredentialInfoHook, } from '../hooks/use-credential' import type { FormSchema } from '@/app/components/base/form/types' import { FormTypeEnum } from '@/app/components/base/form/types' @@ -37,6 +36,7 @@ export type AddOAuthButtonProps = { buttonRightClassName?: string dividerClassName?: string disabled?: boolean + onUpdate?: () => void } const AddOAuthButton = ({ pluginPayload, @@ -47,6 +47,7 @@ const AddOAuthButton = ({ buttonRightClassName, dividerClassName, disabled, + onUpdate, }: AddOAuthButtonProps) => { const { t } = useTranslation() const renderI18nObject = useRenderI18nObject() @@ -61,17 +62,16 @@ const AddOAuthButton = ({ redirect_uri, } = data || {} const isConfigured = is_system_oauth_params_exists || Object.keys(client_params || {}).length > 0 - const invalidatePluginCredentialInfo = useInvalidPluginCredentialInfoHook(pluginPayload) const handleOAuth = useCallback(async () => { const { authorization_url } = await getPluginOAuthUrl() if (authorization_url) { openOAuthPopup( authorization_url, - invalidatePluginCredentialInfo, + () => onUpdate?.(), ) } - }, [getPluginOAuthUrl, invalidatePluginCredentialInfo]) + }, [getPluginOAuthUrl, onUpdate]) const renderCustomLabel = useCallback((item: FormSchema) => { return ( @@ -177,14 +177,14 @@ const AddOAuthButton = ({