Skip to content

Commit 2562939

Browse files
committed
improvement(integrations): simplify Dynamics OAuth UI
1 parent e7a9884 commit 2562939

3 files changed

Lines changed: 7 additions & 15 deletions

File tree

apps/sim/app/workspace/[workspaceId]/components/connect-oauth-modal/connect-oauth-modal.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -224,24 +224,20 @@ export function ConnectOAuthModal(props: ConnectOAuthModalProps) {
224224

225225
const newScopes = !isConnect ? (props.newScopes ?? EMPTY_SCOPES) : EMPTY_SCOPES
226226

227-
const newScopesSet = useMemo(
228-
() => new Set([...newScopes].filter((scope) => !isHiddenScope(scope))),
229-
[newScopes]
227+
const newScopesSet = new Set(newScopes.filter((scope) => !isHiddenScope(scope)))
228+
const displayScopes = [...dataverseEnvironmentForm.effectiveScopes].filter(
229+
(scope) => !isHiddenScope(scope)
230230
)
231231

232-
const displayScopes = useMemo(() => {
233-
const filtered = [...dataverseEnvironmentForm.effectiveScopes].filter(
234-
(scope) => !isHiddenScope(scope)
235-
)
236-
if (isConnect) return filtered
237-
return filtered.sort((a, b) => {
232+
if (!isConnect) {
233+
displayScopes.sort((a, b) => {
238234
const aIsNew = newScopesSet.has(a)
239235
const bIsNew = newScopesSet.has(b)
240236
if (aIsNew && !bIsNew) return -1
241237
if (!aIsNew && bIsNew) return 1
242238
return 0
243239
})
244-
}, [isConnect, dataverseEnvironmentForm.effectiveScopes, newScopesSet])
240+
}
245241

246242
/**
247243
* Initialize the connect form once per open session, after credentials have

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ export function CredentialSelector({
6363
const label = subBlock.placeholder || 'Select credential'
6464
const serviceId = subBlock.serviceId || ''
6565
const isAllCredentials = !serviceId
66-
const effectiveProviderId = useMemo(
67-
() => getProviderIdFromServiceId(serviceId) as OAuthProvider,
68-
[serviceId]
69-
)
66+
const effectiveProviderId = getProviderIdFromServiceId(serviceId) as OAuthProvider
7067

7168
const { depsSatisfied, dependsOn, dependencyValues } = useDependsOnGate(blockId, subBlock, {
7269
disabled,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export function assertMicrosoftDataverseWebOAuthAvailable(): void {
5353
}
5454
}
5555

56-
/** Starts the environment-bound Dataverse OAuth flow without changing the generic OAuth hook. */
5756
export function useConnectMicrosoftDataverseOAuthService() {
5857
const queryClient = useQueryClient()
5958

0 commit comments

Comments
 (0)