cancel
Showing results for 
Search instead for 
Did you mean: 

Flushed information with oData kapsel plugin persisting in the application after refreshing store

Former Member
0 Kudos

Hello!!

In the last months as front-end developer I have been developing an hybrid offline application using the OData Kapsel plugin and Gateway as Odata producer.

Application create entries in the device and modifies entries assigned from the backend, with this scenario user can modify (PUT) or create new entries (POST) synchronizing the device with backend on demand.

Nevertheless I am having the next problem with the synchro, after the synchronization those items assigned from the backend and modified in the device  (items have id )are deleted of the outbox and (of course) this is perfect, but those items created from the device (without id or id in blank) persist in the device after refresh with the flag: @com.sap.vocabularies.Offline.v1.islocal (added by the plugin), showing in the outbox view items synchronized.

Also if the user has a business error (sending backend a message error) the item is deleted in both scenarios after the synchronization.

For this reason, I have been asking in the forum and collaborating with other users about this topic without 100% success, for example: a couple weeks ago even I implemented a DELETE method before the FLUSH information (Odata plugin) and this is working but it is not a good solution if you have errors in the synchronization because you are losing data.

Any clue about this topic as expert in these types of implementations? I am not finding the solution about it..


Thank you in advance.


Óscar

Accepted Solutions (1)

Accepted Solutions (1)

david_brandow
Contributor
0 Kudos

I'm a bit confused, you appear to have indicated in that linked forum post that you had been successful. Is that not the case?

The general flow is that you create the items locally, which get a local key value and the isLocal flag set to true.  When the flush occurs, it sends the new entries to the backend, which creates them and gives them the real key value.  When the refresh occurs, it sends those entries from the backend to the client, which should harmonize those local entries with the updated values from the server.

It sounds like the problem you are having is that that harmonization process is unsuccessful.  Typically, this is because the OData backend is sending incorrect information back.


Without greater details, it would be difficult to try to diagnose why you are having problems.  As noted in earlier suggestions in different threads, I would recommend sending requests to your OData backend directly to make sure that it is responding with the appropriate information.  If that doesn't help, you would need to provide greater detail about the requests and responses you are making/receiving, either in the forum or by filing a support ticket.

Former Member
0 Kudos

Hello David, thank you for your response..

Items created from the front end I made delete in local because after the synchronization items were in the outbox indefinitely (and in my store did appears with the flag isLocal) for this reason I did "delete" previously to the flush..

I tested with POSTMAN the request/response and the result is:

As far I know OData protocol said same object sent from the frontend should be the same object in the response from the server.. right?

In my opinion, I should not make local deletes and the implementation should be transparent from the front-end point of view, and only implement flush and refresh.

Thank you in advance.

david_brandow
Contributor
0 Kudos

Agreed, doing a delete after doing the create is definitely not the right solution to your problem.

If the OData backend is responding appropriately, with the keys matching, then its at least possible that you are running into a bug.  I would suggest you file a support ticket, accompanying it with a full set of client and server logs with the appropriate logging levels set and reproduction steps, and we'll have a look into why this is happening.  Again, the typical reason is that there's a mismatch in key values being sent back from the backend, so you could check those responses when your real application is running in the meantime.

Former Member
0 Kudos

I have one more question if you are so kind to answer:

When does the clear (harmonization) happen? :

When the flush (POST) finishes? or when the next refresh occurs?

Imagine our situation, we create a new entry/record doing a POST operation (with or without ID, it does not matter), then we flush and refresh, but the new entry is not cleared, we have seen the server is responding adequately during the flush. The fact is that we do not have an EXACT mirror, because the refresh is not supposed to give the new entry back. Should the refresh give the new entry back for this harmonization to happen?

Thank you David,

david_brandow
Contributor
0 Kudos

Before the refresh occurs, you will definitely have a local entity with a local key, that's expected behaviour.

After the refresh occurs, it should get the real data back from the OData backend and should harmonize the local entity with the responses from the backend and you should no longer have isLocal=true entities in the list.

Again, the most likely reason for this not working is a mismatch in key values. If you are monkeying around with key values, that's where I would start looking.

Former Member
0 Kudos

Thank you very much for your help.

Application is working correctly now, the problem was we were not considering both local and remote stores had to be mirrors.

If I need more clarification I will kindly ask you for help.

Regards.

Answers (0)