feat: clear default AI profile when removing selected profile

- Added logic to clear the default AI profile ID if the selected profile is being removed from the AI profiles list. This ensures that the application maintains a valid state when profiles are deleted.
This commit is contained in:
Kacper
2025-12-20 01:59:11 +01:00
parent 80cf932ea4
commit 3ca1daf44c

View File

@@ -1513,6 +1513,10 @@ export const useAppStore = create<AppState & AppActions>()(
// Only allow removing non-built-in profiles
const profile = get().aiProfiles.find((p) => p.id === id);
if (profile && !profile.isBuiltIn) {
// Clear default if this profile was selected
if (get().defaultAIProfileId === id) {
set({ defaultAIProfileId: null });
}
set({ aiProfiles: get().aiProfiles.filter((p) => p.id !== id) });
}
},