fix FK constraint: skip duplicate messages before thread reconstruction
- insertMessages checks (mailboxId, uid) existence before INSERT, returns only actually inserted records - syncMailbox only runs ThreadReconstructor on newly inserted messages, preventing FK violations from stale UUIDs referencing ignored records - improve error logging to show full error description Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -207,10 +207,10 @@ final class MailViewModel {
|
||||
try await coordinator.syncNow()
|
||||
syncState = coordinator.syncState
|
||||
} catch {
|
||||
let desc = "\(type(of: error)): \(error.localizedDescription)"
|
||||
let desc = "\(error)"
|
||||
print("[MailViewModel] syncNow failed: \(desc)")
|
||||
errorMessage = desc
|
||||
syncState = .error(desc)
|
||||
errorMessage = error.localizedDescription
|
||||
syncState = .error(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user