From 6433afb03b51778880fad3f317cca0ffa70a7d49 Mon Sep 17 00:00:00 2001 From: KoloMl Date: Sat, 22 Jun 2024 14:30:02 +0400 Subject: [PATCH] Fixed active profile ID still pointing on profile when it's deleted --- src/stores/maintenance-profiles-store.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/stores/maintenance-profiles-store.js b/src/stores/maintenance-profiles-store.js index c71b0f3..5b00d04 100644 --- a/src/stores/maintenance-profiles-store.js +++ b/src/stores/maintenance-profiles-store.js @@ -44,4 +44,11 @@ activeProfileStore.subscribe(profileId => { lastActiveProfileId = profileId; void maintenanceSettings.setActiveProfileId(profileId); -}) +}); + +// Watch the existence of the active profile on every change. +MaintenanceProfile.subscribe(profiles => { + if (!profiles.find(profile => profile.id === lastActiveProfileId)) { + activeProfileStore.set(null); + } +});