You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible to create two objects, which are otherwise identical, but are not equal due to their "_fulfilled" property and the exact mechanism is which they are created.
Namely, if you have an object which has fragment fields, the value of that object.fragments.myFragment is not the same as the exact same fragment created directly.
Version
1.1.1
Steps to reproduce the behavior
Have an object which uses a fragment.
Create the object using .from(<mock>)
Create the fragment type use .from(<mock>)
Check object.fragments.fragementtype == fragment, notice they are not equal due to the value of "_fulfilled" beind different.
Example:
Suppose you have a query that looks something like:
fragment queryResponseFields on QueryResponse {
propertyOne
}
query MyQuery {
myQueryResponse {
...queryResponseFields
}
}
let mockData = Mock<QueryResponse>(propertyOne: "Some Value")
let realObject = MyQuery.MyQueryResponse.from(mockData)
let fragmentObject = QueryResponseFields.from(mockData)
XCTAssertTrue(realObject.fragments.queryResponseFields == fragmentObject) // returns false
Logs
No response
Anything else?
No response
The content you are editing has changed. Please copy your edits and refresh the page.
I believe the equality operator just compares the underlying dictionary, which is why this is the case. But i'm unclear on why exactly the _fulfilled property is different...or even what it is for.
The _fulfilled property is computed during GraphQL execution to keep track of which fragments in the selection set were executed. This is used to determine which fragments the model can be converted to (for type cases and conditional fragments).
It should not be used as part of equality checks, which is an unintended side effect of the implementation. I'm going to work on a fix for this. :)
Summary
It is possible to create two objects, which are otherwise identical, but are not equal due to their "_fulfilled" property and the exact mechanism is which they are created.
Namely, if you have an object which has fragment fields, the value of that object.fragments.myFragment is not the same as the exact same fragment created directly.
Version
1.1.1
Steps to reproduce the behavior
.from(<mock>)
.from(<mock>)
Example:
Suppose you have a query that looks something like:
Logs
No response
Anything else?
No response
Tasks
The text was updated successfully, but these errors were encountered: