From d2f44d3ee203802a16d730ae1743fe4781e9911f Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Fri, 4 Oct 2024 21:28:56 +0200 Subject: [PATCH] Fix new profiles not being saved Broken in #685 --- .../Library/Sources/AppLibrary/Business/ProfileManager.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Passepartout/Library/Sources/AppLibrary/Business/ProfileManager.swift b/Passepartout/Library/Sources/AppLibrary/Business/ProfileManager.swift index 7083208d..40ac72cf 100644 --- a/Passepartout/Library/Sources/AppLibrary/Business/ProfileManager.swift +++ b/Passepartout/Library/Sources/AppLibrary/Business/ProfileManager.swift @@ -120,7 +120,8 @@ extension ProfileManager { public func save(_ profile: Profile, isShared: Bool? = nil) async throws { pp_log(.app, .notice, "Save profile \(profile.id)...") do { - if let existingProfile = allProfiles[profile.id], profile != existingProfile { + let existingProfile = allProfiles[profile.id] + if existingProfile == nil || profile != existingProfile { try await beforeSave?(profile) try await repository.saveEntities([profile])