I’m using the Parse iOS SDK 1.19.2. I have a problem with dummy data returned from Cloud Code functions overwriting previously fetched data:
My data model contains a parent-child relationship (the child stores a reference to the parent). I use a CC function to query the parent object with all its properties (name etc.); later I use another CC function to create a new child object. The returned child object only contains a dummy parent object (i.e. only has the id, but no other properties). This dummy object overwrites the “real” parent object I previously fetched with the 1st function.
I double-checked this observation by explicitly using
include in the 2nd CC function to include the entire parent object, and sure enough this avoids the problem on the client – the cached object now keeps its data.
Now my question is whether this is intended behavior, and if it is, how I can disable it.
P.S.: In the following, I’ll outline my exact setup (maybe the simplified example above lacks something important):
I use a CC function to find and return a
Projectobject. I store this object in an in-memory cache.
After that, I use another CC function to create and return a new
Taskobjects have an
Elementobjects have a
Project, so you could look up the
The 2nd CC function’s response
Task fully includes the
Element property, but this in turn does not include the nested
task.element is the full
Element object, but
task.element.project is a just dummy
Th outcome of this is that after the 2nd CC function has returned, the cached
Project object has lost all its data; e.g.
project.name contained the project name after the 1st call, but is nil after the 2nd call.