fix(editor): Fix OAuth2 credential showing "Needs first setup" after connecting (#29617)

This commit is contained in:
Stephen Wright
2026-05-01 12:25:55 +00:00
committed by GitHub
parent 86f47ee6dc
commit 243f665e60
3 changed files with 12 additions and 0 deletions
@@ -1183,6 +1183,7 @@ async function deleteCredential() {
async function oAuthCredentialAuthorize() {
let url;
credentialsStore.pendingOAuthRefresh = true;
const credential = await saveCredential();
if (!credential) {
return;
@@ -44,6 +44,8 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => {
type CredentialTestStatus = 'pending' | 'success' | 'error';
const credentialTestResults = ref(new Map<string, CredentialTestStatus>());
const pendingOAuthRefresh = ref(false);
const isCredentialTestedOk = (id: string): boolean => {
return credentialTestResults.value.get(id) === 'success';
};
@@ -520,6 +522,7 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => {
getCredentialTranslation,
setCredentialSharedWith,
claimFreeAiCredits,
pendingOAuthRefresh,
};
});
@@ -145,6 +145,14 @@ listenForModalChanges({
if ([CREDENTIAL_SELECT_MODAL_KEY, CREDENTIAL_EDIT_MODAL_KEY].includes(modalName as string)) {
void router.replace({ params: { credentialId: '' }, query: route.query });
}
if (modalName === CREDENTIAL_EDIT_MODAL_KEY && credentialsStore.pendingOAuthRefresh) {
credentialsStore.pendingOAuthRefresh = false;
void credentialsStore.fetchAllCredentials({
projectId: route?.params?.projectId as string | undefined,
includeScopes: true,
externalSecretsStore: filters.value.externalSecretsStore,
});
}
},
});