contentful.java icon indicating copy to clipboard operation
contentful.java copied to clipboard

Sync: linked entries are not returned once the entity has been changed

Open drezzzik opened this issue 5 years ago • 3 comments

  1. Update one field of entry which has linked entries
  2. sync with proper token
  3. sync result: 1 entry changed - as expected
  4. entry has 0 linked entries - not expected
  5. raw field holds proper information

version of lib: 10.4.3

Check screenshot attached.

Screen Shot 2020-07-08 at 19 18 32

drezzzik avatar Jul 09 '20 06:07 drezzzik

That exact issue occurs in ResourceUtils func resolveArrayOfLinks line 118. The lib tries to load linked resource from current fetched (synced) items - which obviously can't work!

Edit: Not only resolveArrayOfLinks - every not initial sync which uses link resolution that way is broken.

lechld avatar Jul 10 '20 09:07 lechld

@drezzzik @lechld Thanks for spotting that, we will try to fix it in the next release.

rafalniski avatar Jul 10 '20 14:07 rafalniski

We also observe (probably related?) anomaly when using cdaClient.sync(syncToken) API (we don't observe this problem when using cdaClient.sync(oldSyncSpace) API.

As far as I understand, cdaClient.sync(oldSyncSpace) API might eventually produce syncSpace that contains ALL space's contents (i.e. keep whole DB copy in heap 🙂 ), this is the reason we try to rely on cdaClient.sync(syncToken).

Scenario:

  • create parent object of type Shelf with property "books" that is a list of children objects of type Book. Let our list contain just one book for now.
  • unpublish Shelf object (parent).
  • make 1st sync (full sync) - SynchronizedSpace.items[0] shall contain our Book (that is ok, because Shelf object is effectively not visible to external world, but the Book object is).
  • publish Shelf object (parent).
  • BUG: make 2nd sync (using token of the 1st sync). SynchronizedSpace.items shall contain Shelf object (it became published), however its "books" property will be empty. So we never get a fact that Book child object is sitting within parent Shelf. Note, that incoming Shelf object does contain link to the Book in SynchronizedSpace.items[0].rawFields.books...sys field, book is just not getting resolved by SDK - it does not appear within SynchronizedSpace.items[0].fields.books .

BigCatAccount avatar Aug 04 '20 05:08 BigCatAccount