Fix active profile not always cleared on deletion
Was only cleared if deleted profile was current profile.
This commit is contained in:
parent
dc66f514d9
commit
10537c5a29
|
@ -335,10 +335,6 @@ extension ProfileManager {
|
|||
// IMPORTANT: invalidate current profile if deleted
|
||||
if !currentProfile.value.isPlaceholder && !newHeaders.keys.contains(currentProfile.value.id) {
|
||||
pp_log.info("\tCurrent profile deleted, invalidating...")
|
||||
if isCurrentProfileActive() {
|
||||
pp_log.info("\tCurrent profile was also active, deactivating...")
|
||||
activeProfileId = nil
|
||||
}
|
||||
currentProfile.value = .placeholder
|
||||
}
|
||||
|
||||
|
@ -348,6 +344,11 @@ extension ProfileManager {
|
|||
currentProfile.value = newProfile
|
||||
}
|
||||
|
||||
if let activeProfileId = activeProfileId, !newHeaders.keys.contains(activeProfileId) {
|
||||
pp_log.info("\tActive profile was deleted")
|
||||
self.activeProfileId = nil
|
||||
}
|
||||
|
||||
// IMPORTANT: defer task to avoid recursive saves
|
||||
// FIXME: Core Data, not sure about this workaround
|
||||
Task {
|
||||
|
|
Loading…
Reference in New Issue