Skip to content

Commit cc31c31

Browse files
committed
wip
1 parent bdf22ed commit cc31c31

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

Sources/SQLiteData/CloudKit/Internal/MockCloudDatabase.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,19 @@
2020
}
2121

2222
mutating func saveRecord(_ record: CKRecord) {
23-
guard let existingEntry = storage[record.recordID.zoneID]?.entries[record.recordID]
23+
guard var existingEntry = storage[record.recordID.zoneID]?.entries[record.recordID]
2424
else {
2525
storage[record.recordID.zoneID]?.entries[record.recordID] =
2626
RecordEntry(record: record, history: [:])
2727
return
2828
}
29-
var updatedEntry = existingEntry
3029
if let existingRecordChangeTag = existingEntry.record._recordChangeTag,
3130
let existingRecordCopy = existingEntry.record.copy() as? CKRecord
3231
{
33-
updatedEntry.history[existingRecordChangeTag] = existingRecordCopy
32+
existingEntry.history[existingRecordChangeTag] = existingRecordCopy
3433
}
35-
updatedEntry.record = record
36-
storage[record.recordID.zoneID]?.entries[record.recordID] = updatedEntry
34+
existingEntry.record = record
35+
storage[record.recordID.zoneID]?.entries[record.recordID] = existingEntry
3736
}
3837
}
3938

0 commit comments

Comments
 (0)