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

Local Realm changes not detected for entities with relationship which have Int primary keys #154

Open
sskjames opened this issue Jun 1, 2021 · 5 comments

Comments

@sskjames
Copy link
Contributor

sskjames commented Jun 1, 2021

Hi,

SyncKit is just being integrated into our app which uses Realm as the local database.
Whenever changes are made to the local Realm, CloudKitSynchronizer is called to sync with the CloudKit private db.
However, I observed that only the "inserted" records are being synced.
When I "update" or "delete" a record locally it's not getting synced.

But I observed a different behaviour when I delete and re-install the app. Data from CloudKit is downloaded to the local Realm as expected.
Inserted, updated and deleted records are all getting synced as expected.

I couldn't recreate this problem with the Example app.

I'm not able to understand why I'm facing this behaviour. What is that I have missed or misconfigured? Can someone please throw some light on this?

Thanks in advance,
James

@sskjames sskjames changed the title Local Realm changes not detected until records are downloaded from CloudKit Local Realm changes not detected for entities with relationship which has Int primary keys Jun 2, 2021
@sskjames
Copy link
Contributor Author

sskjames commented Jun 2, 2021

Got more clarity on the behaviour. I observed that local changes were not detected correctly for entities which have relationship and most of my entities have Integer primary key. Looks like this might be the reason.

When I made changes in entities which didn't have any relationship, they are synced as expected.

@sskjames sskjames changed the title Local Realm changes not detected for entities with relationship which has Int primary keys Local Realm changes not detected for entities with relationship which have Int primary keys Jun 3, 2021
@sskjames
Copy link
Contributor Author

sskjames commented Jun 3, 2021

Sync works as expected when String primary keys are used. Entities having Int primary keys and relationships are not synced as and when changes are detected.

Since we are planning to move to String primary keys, I'll close this issue.

@sskjames sskjames closed this as completed Jun 3, 2021
@mentrena
Copy link
Owner

mentrena commented Jun 4, 2021

Thanks, I'll reopen to keep as a reminder. Now that I went through the trouble of supporting int primary keys I'd better make sure it works...

@mentrena mentrena reopened this Jun 4, 2021
@mentrena
Copy link
Owner

Hey @sskjames I'm trying to reproduce the issue you described with int primary keys, could you clarify:

  • Were changes not detected in the parent entity or the child entity?
  • Did you mean that when you insert object A, it gets synced correctly, but if you make further changes to A then those changes are not detected?

@sskjames
Copy link
Contributor Author

Hi @mentrena,

Did you mean that when you insert object A, it gets synced correctly, but if you make further changes to A then those changes are not detected?

Yes, you are right.

Were changes not detected in the parent entity or the child entity?

I couldn't answer it convincingly. In most cases, I observed it to be the parent and in some cases, to be the child entity.

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