Description
I'm running into a strange issue, and I was wondering if you could offer any initial insights/intuitions while I look into it further. We're using Android Parse SDK 1.11.0.
High level repro steps:
- Create an invoice on device 1 using our app, this creates an Invoice object and stores it at parse
- Device 2 picks this up, gets a copy of the object, stores it locally, it looks good
- On device 1, we now make a change to one of the fields on this object, a JSON field (containing a map or array)
- Device 2 picks this up, gets a copy of the object, stores it locally, but it doesn't look good. The ParseObject it got does not match what is shown on the Parse.com dashboard, it is out of date and doesn't reflect the changes made by device 1 at parse.com.
More details:
a. We can repro this when Device 2 is Android and Device 1 is Android, we can also repro this when Device 2 is Android and device 1 is iOS. We cannot repro this if device 2 is iOS. I think this tells us its likely a bug in the Android SDK (assuming iOS SDK behaviour is correct)
b. The code used in Step 2 to get the object from parse is like this:
public Task<List<T>> get() {
final ParseQuery<T> query = ParseQuery.getQuery(cls);
query.whereEqualTo("account", account);
query.setLimit(LIMIT);
return pageAllResults(query);
}
private Task<List<T>> pageAllResults(final ParseQuery<T> query, final List<T> allResults, final int offset, final int page) {
query.setSkip(offset);
Log.d(TAG, String.format("pageAllResults (Offset=%d, Page=%d)", offset, page));
return query.findInBackground().onSuccessTask(new Continuation<List<T>, Task<List<T>>>() {
@Override
public Task<List<T>> then(Task<List<T>> task) throws Exception {
List<T> results = task.getResult();
allResults.addAll(results);
if (results.size() == LIMIT)
return pageAllResults(query, allResults, offset + results.size(), page + 1);
else
return Task.forResult(allResults);
}
});
}
c. We can't repro this issue for primitive fields, like a string. So, for example, if on Device 1 you change a JSON field and a primitive field, then, when Device 2 gets the object using the query it will have the updated primitive field value, but not the updated JSON field value.
d. We tried reproing this by making manual changes at parse.com, and we haven't yet been able to repro the problem this way. Summarizing: if we make the changes using the Android SDK or the iOS SDK then we can repro the problem.
We're going to try calling ParseObject.fetchInBackground for each object in the query results to see if that works around the issue.
My expectation was that after calling ParseQuery.findInBackground
and then calling ParseQuery.getResult
that the resulting ParseObjects would have current data in them matching what is at parse.com