Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/components/layout/settings/apikeys/byok-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const PROVIDERS: Provider[] = [

export function ByokSection() {
const queryClient = useQueryClient()
const { userKeyStatus, refreshUserKeyStatus, refreshModels } = useModel()
const { userKeyStatus, refreshAll } = useModel()
const [selectedProvider, setSelectedProvider] = useState<string>("openrouter")
const [apiKeys, setApiKeys] = useState<Record<string, string>>({})
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false)
Expand Down Expand Up @@ -146,8 +146,8 @@ export function ByokSection() {
: `Your ${providerConfig?.name} API key has been updated.`,
})

// Refresh models and user key status
await Promise.all([refreshUserKeyStatus(), refreshModels()])
// Use refreshAll to ensure models, user key status, and favorites are all in sync after saving a key
await refreshAll()

// If new models were added to favorites, refresh the favorite models cache
if (response.isNewKey) {
Expand Down Expand Up @@ -185,7 +185,7 @@ export function ByokSection() {
title: "API key deleted",
description: `Your ${providerConfig?.name} API key has been deleted.`,
})
await Promise.all([refreshUserKeyStatus(), refreshModels()])
await refreshAll()
setApiKeys((prev) => ({ ...prev, [provider]: "" }))
setDeleteDialogOpen(false)
setProviderToDelete("")
Expand Down