Skip to content

Commit 349fa0b

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(byok): hide stale inherited status badges
1 parent fbee11d commit 349fa0b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

apps/sim/app/workspace/[workspaceId]/settings/components/byok/byok.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ vi.mock('@/hooks/queries/byok-keys', () => ({
162162
return mocks.organizationResult.current
163163
},
164164
useInheritedBYOKStatus: () => ({
165-
data: mocks.inheritedStatusError.current ? undefined : { inheritedProviderIds: ['anthropic'] },
165+
data: { inheritedProviderIds: ['anthropic'] },
166166
isError: mocks.inheritedStatusError.current,
167167
}),
168168
useUpsertBYOKKey: mocks.mutation,
@@ -258,6 +258,7 @@ describe('BYOK scope access', () => {
258258
expect(container.textContent).toContain(
259259
'Inherited key status unavailable. Refresh to try again.'
260260
)
261+
expect(container.textContent).not.toContain('Inherited from organization')
261262
expect(container.querySelector('[aria-label="BYOK manager"]')).toHaveAttribute(
262263
'data-capabilities',
263264
'true:true:true'

apps/sim/app/workspace/[workspaceId]/settings/components/byok/byok.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ export function BYOK() {
435435
}, [activeKeys])
436436

437437
const providers = useMemo(() => {
438-
if (isOrganizationScope) return PROVIDERS
438+
if (isOrganizationScope || inheritedStatus.isError) return PROVIDERS
439439

440440
const inheritedProviderIds = new Set(inheritedStatus.data?.inheritedProviderIds ?? [])
441441
if (inheritedProviderIds.size === 0) return PROVIDERS
@@ -445,7 +445,7 @@ export function BYOK() {
445445
? { ...provider, badge: <ChipTag variant='gray'>Inherited from organization</ChipTag> }
446446
: provider
447447
)
448-
}, [inheritedStatus.data?.inheritedProviderIds, isOrganizationScope])
448+
}, [inheritedStatus.data?.inheritedProviderIds, inheritedStatus.isError, isOrganizationScope])
449449

450450
const description = isOrganizationScope
451451
? organizationKeys.data?.entitled === false

0 commit comments

Comments
 (0)