Skip to content

Commit

Permalink
fix: preserve complete provider settings in cookies
Browse files Browse the repository at this point in the history
Previously only the enabled state was being saved to cookies, causing loss of provider configuration like baseURL.
  • Loading branch information
xKevIsDev committed Feb 20, 2025
1 parent 097dffd commit 220e2da
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/lib/hooks/useSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,11 @@ export function useSettings(): UseSettingsReturn {
[saveSettings],
);

// Fix the providers cookie sync
useEffect(() => {
const providers = providersStore.get();
const providerSetting: Record<string, { enabled: boolean }> = {};
const providerSetting: Record<string, IProviderSetting> = {}; // preserve the entire settings object for each provider
Object.keys(providers).forEach((provider) => {
providerSetting[provider] = {
enabled: providers[provider].settings.enabled || false, // Add fallback for undefined
};
providerSetting[provider] = providers[provider].settings;
});
Cookies.set('providers', JSON.stringify(providerSetting));
}, [providers]);
Expand Down

0 comments on commit 220e2da

Please sign in to comment.