mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(knowledge): pass workspaceId to useOAuthCredentials in connector card
The ConnectorCard was calling useOAuthCredentials(providerId) without a workspaceId, causing the credentials API to return an empty array. This meant the credential lookup always failed, getMissingRequiredScopes received undefined, and the "Update access" banner always appeared. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1056,6 +1056,7 @@ export function KnowledgeBase({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ConnectorsSection
|
<ConnectorsSection
|
||||||
|
workspaceId={workspaceId}
|
||||||
knowledgeBaseId={id}
|
knowledgeBaseId={id}
|
||||||
connectors={connectors}
|
connectors={connectors}
|
||||||
isLoading={isLoadingConnectors}
|
isLoading={isLoadingConnectors}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import { getMissingRequiredScopes } from '@/hooks/use-oauth-scope-status'
|
|||||||
const logger = createLogger('ConnectorsSection')
|
const logger = createLogger('ConnectorsSection')
|
||||||
|
|
||||||
interface ConnectorsSectionProps {
|
interface ConnectorsSectionProps {
|
||||||
|
workspaceId: string
|
||||||
knowledgeBaseId: string
|
knowledgeBaseId: string
|
||||||
connectors: ConnectorData[]
|
connectors: ConnectorData[]
|
||||||
isLoading: boolean
|
isLoading: boolean
|
||||||
@@ -67,6 +68,7 @@ const STATUS_CONFIG = {
|
|||||||
} as const
|
} as const
|
||||||
|
|
||||||
export function ConnectorsSection({
|
export function ConnectorsSection({
|
||||||
|
workspaceId,
|
||||||
knowledgeBaseId,
|
knowledgeBaseId,
|
||||||
connectors,
|
connectors,
|
||||||
isLoading,
|
isLoading,
|
||||||
@@ -179,6 +181,7 @@ export function ConnectorsSection({
|
|||||||
<ConnectorCard
|
<ConnectorCard
|
||||||
key={connector.id}
|
key={connector.id}
|
||||||
connector={connector}
|
connector={connector}
|
||||||
|
workspaceId={workspaceId}
|
||||||
knowledgeBaseId={knowledgeBaseId}
|
knowledgeBaseId={knowledgeBaseId}
|
||||||
canEdit={canEdit}
|
canEdit={canEdit}
|
||||||
isSyncing={isSyncing}
|
isSyncing={isSyncing}
|
||||||
@@ -265,6 +268,7 @@ export function ConnectorsSection({
|
|||||||
|
|
||||||
interface ConnectorCardProps {
|
interface ConnectorCardProps {
|
||||||
connector: ConnectorData
|
connector: ConnectorData
|
||||||
|
workspaceId: string
|
||||||
knowledgeBaseId: string
|
knowledgeBaseId: string
|
||||||
canEdit: boolean
|
canEdit: boolean
|
||||||
isSyncing: boolean
|
isSyncing: boolean
|
||||||
@@ -278,6 +282,7 @@ interface ConnectorCardProps {
|
|||||||
|
|
||||||
function ConnectorCard({
|
function ConnectorCard({
|
||||||
connector,
|
connector,
|
||||||
|
workspaceId,
|
||||||
knowledgeBaseId,
|
knowledgeBaseId,
|
||||||
canEdit,
|
canEdit,
|
||||||
isSyncing,
|
isSyncing,
|
||||||
@@ -300,7 +305,7 @@ function ConnectorCard({
|
|||||||
const providerId = serviceId ? getProviderIdFromServiceId(serviceId) : undefined
|
const providerId = serviceId ? getProviderIdFromServiceId(serviceId) : undefined
|
||||||
const requiredScopes = connectorDef?.oauth.requiredScopes ?? []
|
const requiredScopes = connectorDef?.oauth.requiredScopes ?? []
|
||||||
|
|
||||||
const { data: credentials } = useOAuthCredentials(providerId)
|
const { data: credentials } = useOAuthCredentials(providerId, { workspaceId })
|
||||||
|
|
||||||
const missingScopes = useMemo(() => {
|
const missingScopes = useMemo(() => {
|
||||||
if (!credentials || !connector.credentialId) return []
|
if (!credentials || !connector.credentialId) return []
|
||||||
|
|||||||
Reference in New Issue
Block a user