Skip to content

Commit c67bafb

Browse files
committed
fix(dataverse): preserve legacy reconnect behavior
1 parent d13f9cc commit c67bafb

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/credential-selector.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,10 @@ export function CredentialSelector({
209209
? getMissingRequiredScopes(selectedCredential!, requiredScopes || [])
210210
: []
211211
const needsUpdate =
212-
hasOAuthSelection &&
213212
!isServiceAccount &&
214-
(missingRequiredScopes.length > 0 ||
215-
dataversePolicy.requiresSeparateCredential ||
216-
dataversePolicy.hasInvalidEnvironment) &&
213+
(dataversePolicy.hasInvalidEnvironment ||
214+
(hasOAuthSelection &&
215+
(missingRequiredScopes.length > 0 || dataversePolicy.requiresSeparateCredential))) &&
217216
!effectiveDisabled &&
218217
!isPreview &&
219218
!credentialsLoading

apps/sim/hooks/queries/oauth/microsoft-dataverse-connections.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ describe('Microsoft Dataverse OAuth connections', () => {
185185
credentialQueryFailed: false,
186186
})
187187
).toThrow('Sim web app')
188+
expect(() =>
189+
assertMicrosoftDataverseReconnectAvailable({
190+
bindingState: 'legacy',
191+
credentialQueryFailed: false,
192+
})
193+
).not.toThrow()
188194
})
189195

190196
it.each([

apps/sim/hooks/queries/oauth/microsoft-dataverse-connections.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export function assertMicrosoftDataverseReconnectAvailable({
6363
bindingState,
6464
credentialQueryFailed,
6565
}: AssertMicrosoftDataverseReconnectAvailableParams): void {
66-
assertMicrosoftDataverseWebOAuthAvailable()
6766
if (credentialQueryFailed) {
6867
throw new Error(
6968
'Could not verify this Dataverse credential’s environment binding. Please try again.'
@@ -74,6 +73,7 @@ export function assertMicrosoftDataverseReconnectAvailable({
7473
'This Dataverse credential has an invalid environment binding and cannot be reconnected in place.'
7574
)
7675
}
76+
if (bindingState === 'bound') assertMicrosoftDataverseWebOAuthAvailable()
7777
}
7878

7979
export function useConnectMicrosoftDataverseOAuthService() {

0 commit comments

Comments
 (0)