Skip to content

Commit

Permalink
Avoid Setting Data when no data is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
PSchmiedmayer committed Jul 23, 2024
1 parent 67981d0 commit 488fba3
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ public actor FirestoreAccountStorage: Module, AccountStorageConstraint {
do {
switch result {
case let .success(data):
guard !data.isEmpty else {
return
}

try await userDocument(for: identifier.accountId)
.setData(data, merge: true)
case let .failure(error):
Expand Down Expand Up @@ -137,7 +141,7 @@ public actor FirestoreAccountStorage: Module, AccountStorageConstraint {
switch result {
case let .success(data):
try await userDocument(for: identifier.accountId)
.setData(data, merge: true)
.updateData(data)
case let .failure(error):
throw error
}
Expand Down

0 comments on commit 488fba3

Please sign in to comment.