Skip to content

Commit feb78b8

Browse files
authored
fix: refresh models list upon adding api keys (#249)
1 parent e2a3f30 commit feb78b8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/components/layout/settings/apikeys/byok-section.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const PROVIDERS: Provider[] = [
9999

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

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

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

0 commit comments

Comments
 (0)