From d2f3f53f57074621d11a405cb02371e6d3d1d4cf Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Wed, 27 Nov 2024 19:26:15 +0100 Subject: [PATCH] fix(frontend): Fix missing credentials input when no credentials available (#8834) Fixes breakage from f1414550 (#8772) Co-authored-by: Nicholas Tindle --- .../integrations/credentials-provider.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/autogpt_platform/frontend/src/components/integrations/credentials-provider.tsx b/autogpt_platform/frontend/src/components/integrations/credentials-provider.tsx index aeab8f48c38f..9fbae4b1fa92 100644 --- a/autogpt_platform/frontend/src/components/integrations/credentials-provider.tsx +++ b/autogpt_platform/frontend/src/components/integrations/credentials-provider.tsx @@ -208,15 +208,16 @@ export default function CredentialsProvider({ setProviders((prev) => ({ ...prev, - ...Object.entries(credentialsByProvider).reduce( - (acc, [provider, { apiKeys, oauthCreds }]) => ({ - ...acc, - [provider]: { + ...Object.fromEntries( + CREDENTIALS_PROVIDER_NAMES.map((provider) => [ + provider, + { provider, providerName: providerDisplayNames[provider as CredentialsProviderName], - savedApiKeys: apiKeys, - savedOAuthCredentials: oauthCreds, + savedApiKeys: credentialsByProvider[provider]?.apiKeys ?? [], + savedOAuthCredentials: + credentialsByProvider[provider]?.oauthCreds ?? [], oAuthCallback: (code: string, state_token: string) => oAuthCallback( provider as CredentialsProviderName, @@ -237,8 +238,7 @@ export default function CredentialsProvider({ force, ), }, - }), - {}, + ]), ), })); });