Skip to content

Commit

Permalink
fix: credential picker filter logic (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-chaturvedi authored Jul 19, 2024
1 parent 484f1a8 commit 346b2ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/components/syncing/ProviderCredentialPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ export const ProviderCredentialPicker = (props: {
? credentials.filter((cred) => cred.provider?.id === providerFilter)
: credentials

const credentialMatchesFilter =
credential && providerFilter ? credential.provider?.id === providerFilter : true

useEffect(() => {
if (setDefault && filteredCredentials.length > 0 && !credential)
if (setDefault && filteredCredentials.length > 0 && !credentialMatchesFilter)
setCredential(filteredCredentials[0])
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [providerFilter, filteredCredentials, setDefault])
Expand Down

0 comments on commit 346b2ad

Please sign in to comment.