Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent record's modified date time updated when a child record was synced the first time #189

Open
sskjames opened this issue Aug 15, 2023 · 3 comments

Comments

@sskjames
Copy link
Contributor

I have two Realm entities where one has a relationship with the other.

class Child: Object, ParentKey {
  @objc dynamic var id: String = ""
  @objc dynamic var parent: Parent?

   static func parentKey() -> String {
        return "parent"
    }
}

class Parent: Object {
}

The Parent record is created and synced to CloudKit. But when the very first Child record is created, I observed that the modifiedDateTime in the CloudKit metadata of the Parent being updated to the Child record's created date time.

As a result, the next time when I make changes to the Parent record, I get a conflict with the CloudKit error code 14, and the changes are lost.

When I make further changes to the Parent or Child record, I don't face any issue. When I create additional Child records, I don't face any issue either.

Appreciate any help I could receive to solve this.

@sskjames
Copy link
Contributor Author

Hi @mentrena, any update on this?

@aehlke
Copy link

aehlke commented Apr 30, 2024

@sskjames I don't think this is maintained anymore especially now that SwiftData is on the horizon as the new standard

I'm maintaining a fork here: https://github.com/lake-of-fire/BigSyncKit for RealmSwift only though.

I'm investigating this bug in my fork now.

edit: It should not be an issue in my fork because I use a custom modifiedAt field with conflict resolution as such: https://github.com/lake-of-fire/BigSyncKit/blob/4cb7cec2da1f2e42aad442024b92e8b99a547725/Sources/BigSyncKit/RealmSwift/RealmSwiftAdapter.swift#L686-L699

@sskjames
Copy link
Contributor Author

sskjames commented May 6, 2024

Hi @aehlke, thank you very much for maintaining the fork. I'll have a look at it and see whether it will fit our usecase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants