-
Notifications
You must be signed in to change notification settings - Fork 749
Closed
apollographql/apollo-ios-dev
#804Labels
Description
Summary
We use various queries that include @skip and @include directives. We use equality to check if our state has changed.
From what I can tell, the result of one of our queries is crashing due to an equality check failing when comparing it to the previous value.
It's not clear to me if this is by design or not given the assert message. If it is, it would be helpful to know why fragments are required.
The stack is as follows:
#6 0x0000000110a1abf0 in SelectionSet.addConditionalSelections(_:to:) at .../Sources/ApolloAPI/SelectionSet+Equatable.swift:141
#7 0x0000000110a1a570 in SelectionSet.addFulfilledSelections(of:to:) at .../Sources/ApolloAPI/SelectionSet+Equatable.swift:52
#8 0x0000000110a1a068 in SelectionSet.fieldsForEquality() at .../Sources/ApolloAPI/SelectionSet+Equatable.swift:29
#9 0x0000000110a1a140 in static SelectionSet.== infix(_:_:) at .../Sources/ApolloAPI/SelectionSet+Equatable.swift:18
This line is being hit:
assertionFailure("Conditional selections should not directly include fields. They should use an InlineFragment instead.")
Version
2.0
Steps to reproduce the behavior
- Define a query that uses conditional fields gated by
@skipand/or@include(i.e.conditionalValue @skip(if: $condition) { field } - Load the results of the query
- Load the results of a second query, changing the value of the @Skip as an example
- Use equality to compare the two results
Logs
Anything else?
No response