Skip to content

Commit c8e0c4d

Browse files
committed
fix(oauth): use createElement for icon components to fix React hooks error
1 parent 0d8d9fb commit c8e0c4d

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useCallback, useEffect, useMemo, useState } from 'react'
3+
import { createElement, useCallback, useEffect, useMemo, useState } from 'react'
44
import { createLogger } from '@sim/logger'
55
import { ExternalLink, Users } from 'lucide-react'
66
import { Button, Combobox } from '@/components/emcn/components'
@@ -203,7 +203,7 @@ export function CredentialSelector({
203203
if (!baseProviderConfig) {
204204
return <ExternalLink className='h-3 w-3' />
205205
}
206-
return baseProviderConfig.icon({ className: 'h-3 w-3' })
206+
return createElement(baseProviderConfig.icon, { className: 'h-3 w-3' })
207207
}, [])
208208

209209
const getProviderName = useCallback((providerName: OAuthProvider) => {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useCallback, useEffect, useMemo, useState } from 'react'
1+
import { createElement, useCallback, useEffect, useMemo, useState } from 'react'
22
import { ExternalLink } from 'lucide-react'
33
import { Button, Combobox } from '@/components/emcn/components'
44
import {
@@ -22,7 +22,7 @@ const getProviderIcon = (providerName: OAuthProvider) => {
2222
if (!baseProviderConfig) {
2323
return <ExternalLink className='h-3 w-3' />
2424
}
25-
return baseProviderConfig.icon({ className: 'h-3 w-3' })
25+
return createElement(baseProviderConfig.icon, { className: 'h-3 w-3' })
2626
}
2727

2828
const getProviderName = (providerName: OAuthProvider) => {

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/integrations/integrations.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useEffect, useRef, useState } from 'react'
3+
import { createElement, useEffect, useRef, useState } from 'react'
44
import { createLogger } from '@sim/logger'
55
import { Check, ChevronDown, ExternalLink, Search } from 'lucide-react'
66
import { useRouter, useSearchParams } from 'next/navigation'
@@ -339,9 +339,7 @@ export function Integrations({ onOpenChange, registerCloseHandler }: Integration
339339
>
340340
<div className='flex items-center gap-[12px]'>
341341
<div className='flex h-9 w-9 flex-shrink-0 items-center justify-center overflow-hidden rounded-[6px] bg-[var(--surface-5)]'>
342-
{typeof service.icon === 'function'
343-
? service.icon({ className: 'h-4 w-4' })
344-
: service.icon}
342+
{createElement(service.icon, { className: 'h-4 w-4' })}
345343
</div>
346344
<div className='flex flex-col justify-center gap-[1px]'>
347345
<span className='font-medium text-[14px]'>{service.name}</span>

0 commit comments

Comments
 (0)