apollo-ios
apollo-ios copied to clipboard
MutableSelectionSet child objects missing selections
Summary
I have a mutable fragment that has relationships to other objects, like this:
fragment MutableIssueFields on Issue @apollo_client_ios_localCacheMutation {
id
state {
id
name
}
}
Codegen ends up creating MutableIssueFields
and MutableIssueFields.State
. The parent object MutableIssueFields
has a __selections
property as you'd expect, but MutableIssueFields.State
does not.
I'm trying to change the value from one "state" to another using a local cache mutation. However, when I try to load the MutableIssueFields.State
object from the cache, I get an empty object because the __selections
field is empty.
I'm calling it like this:
store.withinReadWriteTransaction { tx in
let newState = try tx.readObject(ofType: MutableIssueFields.State.self, withKey: "State:\(id)")
try tx.updateObject(ofType: MutableIssueFields.self) { obj in
obj.state = newState
}
}
Is this something that should be supported? If not, is there a preferred way to update this relationship to another existing object in the cache?
Version
1.14.1
Steps to reproduce the behavior
- Create a fragment marked with @apollo_client_ios_localCacheMutation, that references some child object
- Populate cache with data that will fulfill the fragment
- Use a read write transaction to try to fetch the child object using
readObject
- Observe the child object is returned with empty data
Logs
No response
Anything else?
No response