@@ -99,7 +99,7 @@ const PROVIDERS: Provider[] = [
99
99
100
100
export function ByokSection ( ) {
101
101
const queryClient = useQueryClient ( )
102
- const { userKeyStatus, refreshUserKeyStatus , refreshModels } = useModel ( )
102
+ const { userKeyStatus, refreshAll } = useModel ( )
103
103
const [ selectedProvider , setSelectedProvider ] = useState < string > ( "openrouter" )
104
104
const [ apiKeys , setApiKeys ] = useState < Record < string , string > > ( { } )
105
105
const [ deleteDialogOpen , setDeleteDialogOpen ] = useState ( false )
@@ -146,8 +146,8 @@ export function ByokSection() {
146
146
: `Your ${ providerConfig ?. name } API key has been updated.` ,
147
147
} )
148
148
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 ( )
151
151
152
152
// If new models were added to favorites, refresh the favorite models cache
153
153
if ( response . isNewKey ) {
@@ -185,7 +185,7 @@ export function ByokSection() {
185
185
title : "API key deleted" ,
186
186
description : `Your ${ providerConfig ?. name } API key has been deleted.` ,
187
187
} )
188
- await Promise . all ( [ refreshUserKeyStatus ( ) , refreshModels ( ) ] )
188
+ await refreshAll ( )
189
189
setApiKeys ( ( prev ) => ( { ...prev , [ provider ] : "" } ) )
190
190
setDeleteDialogOpen ( false )
191
191
setProviderToDelete ( "" )
0 commit comments