contentful / contentful-persistence.swift

Simplified persistence for the Contentful Swift Library.
MIT License
24 stars 36 forks source link

One-to-many references not updated #65

Closed Klaudas closed 4 years ago

Klaudas commented 6 years ago

Hey,

We're having several major issues with syncing

  1. Model A has linked multiple reference type sub-model B. We've recently added more content defined by model B and attached it to existing data held by A entry. Although changes are logged and visible inside Contentful panel, the client side seems to ignore it, even though updates were made more than a month ago.

I've tried to initiate sync on both: empty and already existing databases.

  1. Same data structure. I've added additional locale (no new data, just locale), filled all the missing pieces on existing entries and it seems that Assets (images) are not synced properly for newly added language, it doesn't affect other properties.

Note: asset is not localized and is used for all locales. This issue only exists when trying to sync on non-empty Database.

loudmouth commented 6 years ago

Hi @Klaudas,

Regarding point number 1, let me restate in my own words to make sure I understand your issue:

Is this correct?

Regarding the second issue, is it the same issue as described in this Github issue comment? If so, the answer is the same as it is there—it is unfortunately a limitation of the API.

It turns out that that adding a new locale to a space will not cause subsequent sync calls to return "new" content for assets ("new" in this case refering to populating the asset for all locales on the space with fallback-locale logic reflected).

I think the best strategy would be either to do another initial sync; or you could write a script to update your assets in some manner.

Klaudas commented 6 years ago

@loudmouth,

  1. Yes, that is correct,
  2. It seems that it only affects iOS, Android works perfectly fine.
loudmouth commented 6 years ago

Hey @Klaudas ,

I haven't been able to try reproducing this today since I've been busy. I will see what I can do tomorrow however. If this issue is urgent, then I suggest opening a support ticket at support.contentful.com where I can better guarantee faster response times.

loudmouth commented 6 years ago

~A quick update: I was able to reproduce the issue, but I have not yet identified the root cause. It seems that linking new assets and publishing correctly resolves them in the CoreData database, but linking new entries does not.~

loudmouth commented 6 years ago

@Klaudas actually, I must rescind my earlier comment...earlier today, I created a model to manually test, but what I forgot to do when I created this model was add the relevant line for the one-to-many field to the static func fieldMapping() -> [FieldName: String] function.

After adding the relevant line, I have tested both incrementally adding a new reference to my one-to-many links array, and also doing an initial sync and I see all the expected content every time.

This library also has tests that assert that one-to-many links are properly stored in CoreData and that the references are resolved. Thus, after my investigation, I cannot confirm that there is a bug and must assume, for now, that there might be a configuration issue with your project.

If you need help troubleshooting your project, then I suggest opening a support request so we can take a look at your project and content together.

loudmouth commented 5 years ago

@Klaudas did you ever figure this out?

matelo commented 4 years ago

@Klaudas is this issue still relevant?

jroehl commented 4 years ago

Closed due to inactivity