Skip to content

Commit

Permalink
fix: provider menu dropdown fix (ghost providers) (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodacus authored Dec 21, 2024
1 parent 7295352 commit d8943f9
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions app/lib/hooks/useSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,18 @@ export function useSettings() {
if (savedProviders) {
try {
const parsedProviders: Record<string, IProviderSetting> = JSON.parse(savedProviders);
Object.keys(parsedProviders).forEach((provider) => {
const currentProvider = providers[provider];
providersStore.setKey(provider, {
...currentProvider,
settings: {
...parsedProviders[provider],
enabled: parsedProviders[provider].enabled ?? true,
},
});
Object.keys(providers).forEach((provider) => {
const currentProviderSettings = parsedProviders[provider];

if (currentProviderSettings) {
providersStore.setKey(provider, {
...providers[provider],
settings: {
...currentProviderSettings,
enabled: currentProviderSettings.enabled ?? true,
},
});
}
});
} catch (error) {
console.error('Failed to parse providers from cookies:', error);
Expand Down

0 comments on commit d8943f9

Please sign in to comment.