-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ApolloQueryResult
returning partial data in @apollo/client@^3.6.9
with nextFetchPolicy: 'cache-only'
#9923
Comments
Thanks for this @KeithGillette - any chance you'd be able to provide a small runnable reproduction that shows this? |
Thanks for your attention to this bug report, @hwillson. I've looked at the Apollo Client error template projects but I'm unfamiliar with React so a bit stymied on where to start with a simple reproduction, as the issue came out of our rather complex Apollo-Angular project when we noticed a behavior change in |
ObservableQuery.result()
returning partial data in @apollo/client@3.6.9
ObservableQuery.result()
returning partial data in @apollo/client@3.6.9
with nextFetchPolicy: 'cache-only'
ObservableQuery.result()
returning partial data in @apollo/client@3.6.9
with nextFetchPolicy: 'cache-only'
ApolloQueryResult
returning partial data in @apollo/client@3.6.9
with nextFetchPolicy: 'cache-only'
I figured out how to create a simple Apollo-Angular StackBlitz with local schema and I did discover, however, that the return of partial data starting in The problem seems to be restricted to queries on types which have field parameters on multiple array fields similar to the simplified example below. Our application has multiple queries on the same parent document, some of which return only the non-Array properties, some only the type Parent {
_id: ID!
name: String!
childList1 (someParameter: String!: [Child!]
childList2 (someParameter: String!): [Child!]
}
query ParentRead($id: ID!, $list1Filter: String) {
Parent(id: $id) {
id
name
}
}
query ParentReadList1($id: ID!, $list1Filter: String) {
Parent(id: $id) {
id
name
childList1(filter: $list1Filter) {
id
name
}
}
}
query ParentReadList2($id: ID!, $list1Filter: String) {
Parent(id: $id) {
id
name
childList2(filter: $list1Filter) {
id
name
}
}
} Any pointers on troubleshooting to isolate further appreciated. |
This issue persists through |
ApolloQueryResult
returning partial data in @apollo/client@3.6.9
with nextFetchPolicy: 'cache-only'
ApolloQueryResult
returning partial data in @apollo/client@^3.6.9
with nextFetchPolicy: 'cache-only'
I have isolated the source of this issue to the changes in release 3.6.9 in |
Despite including some fixes for incorrectly returning partial data, this issue persists in |
Hey @KeithGillette 👋 ! Thanks for your patience and thanks for all the detail! This looks very similar to #10222 and I'm willing to bet both issues suffer from the same root cause. I did a lot of exploration through this part of the code base when trying to fix that issue (#10239). Unfortunately I ran into a ton of challenges with my initial solution. One of the behaviors introduced in 3.6.9 was that
This is definitely a very tricky part of the code base because there are so many moving parts all working together at the same time. I'd like to revisit that PR soon and come up with an alternative approach. I'm hoping that by fixing #10222, I can also fix this issue as well. I'll make sure to write an additional test for this specific case to make sure this is checked. Thanks again for the help trying to narrow this down! |
While the underlying issue is still present as evidenced by console errors, reliability of data availability for components does appear improved in release 3.7.11. Any updates on your pending fix, @jerelmiller? |
Intended outcome:
The behavior of
ApolloQueryResult
andnextFetchPolicy: 'cache-only'
changed in@apollo/client@3.6.9
. Prior to 3.6.9, thedata
returned in theObservableQuery.result()
Promise resolution or Apollo Angular'sQueryRef.valueChanges
Observable would conform to the shape of the underlying query and we would not see results withpartial: true
.Actual outcome:
Upon updating to
@apollo/client@3.6.9
, we now are gettingdata
with missing fields andpartial: true
with no changes to our codebase.How to reproduce the issue:
Compare resolution of
ApolloQueryResult
between3.6.8
and3.6.9
when multiple queries with different shapes but the same variables are triggered.Versions
System:
OS: macOS 12.4
Binaries:
Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node
npm: 6.14.16 - ~/.nvm/versions/node/v14.19.1/bin/npm
npmPackages:
@apollo/client: 3.6.9 => 3.6.9
apollo-angular: 3.0.1 => 3.0.1
apollo-server-core: 3.10.0 => 3.10.0
apollo-server-express: 3.10.0 => 3.10.0
The text was updated successfully, but these errors were encountered: