From 3ca1daf44c1ea81221b544981472d3f162b2fa72 Mon Sep 17 00:00:00 2001 From: Kacper Date: Sat, 20 Dec 2025 01:59:11 +0100 Subject: [PATCH] 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. --- apps/ui/src/store/app-store.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/ui/src/store/app-store.ts b/apps/ui/src/store/app-store.ts index 75120f18..ee4b134d 100644 --- a/apps/ui/src/store/app-store.ts +++ b/apps/ui/src/store/app-store.ts @@ -1513,6 +1513,10 @@ export const useAppStore = create()( // 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) }); } },