This particular application uses the ‘parse/node’ module and does not allow client side SDK usage.
I have an API endpoint which updates a class “SecondaryData”.
The user selects a singular primary “PrimaryData” which has a pointer to “SecondaryData” and the API updates the “SecondaryData” only and directly via the id. The client then refreshes a Parse.Query(‘PrimaryData’) with a .includes(‘SecondaryData’)
The problem is, the includes contains stale data. It works fine in node. The data remains stale until the application is restarted. (You can make the request as many times as you want) — If you update the ‘PrimaryData’ object, the includes no longer has stale data.
I have investigated the problem a bit in RESTController.js ParseQuery.js and ParseObject.js.
I can’t quite understand, but in fromJSON
it is provided the correct data, and then somewhere inside of fromJSON
the data is replaced with the stale data. I’m not exactly sure where this stale data is coming from. While using vscode debugger it seems strange, but when the id is overwritten
if (otherAttributes.objectId) {
o.id = otherAttributes.objectId;
}
All of the old data just seems to “pop in”.
Any thoughts on the inner workings of Parse’s local object cache? would be appreciated.
Thanks!