From e7f676639681f7c5d8716a38871b16474a07cbce Mon Sep 17 00:00:00 2001 From: JCKL Date: Fri, 12 Jan 2024 01:40:46 -0800 Subject: [PATCH] Update ContactsList.swift When adding fields to Contact, the original implementation didn't guarantee updates when additional fields were added to Contact unless the additional fields were also added here which gets very clunky. I think a better approach is to make the listID by combining self.id with self.userModificationDate. This guarantees updates when new fields are added to Contact and I think is a better pattern for developers to implement going forward. --- SyncEngine/ContactsList.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SyncEngine/ContactsList.swift b/SyncEngine/ContactsList.swift index cd5c4df..9f9d94c 100644 --- a/SyncEngine/ContactsList.swift +++ b/SyncEngine/ContactsList.swift @@ -109,7 +109,7 @@ struct ContactView: View { extension Contact { // In order for the list to update properly when fetch changes from the cloud, we need to use something other than the contact ID for the list item ID. - var listID: String { "\(self.id)\(Self.listIDSeparator)\(self.name)" } + var listID: String { "\(self.id)\(Self.listIDSeparator)\(self.userModificationDate)" } static let listIDSeparator = "::"