-
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
Type policies broken starting 3.3.0 #7535
Comments
@pramodshri-tgsys I downgraded my ApolloClient version to 3.2.8. |
In my case, there was an error in the code but no errors were reported. I didn't have a return statement at the end of the function code. |
@Banou26 This would be pretty worrisome if true, but it does not seem to be reproducing for me. The symptoms are consistent with there not being any field policy defined for the Of course, a reproduction would be even more useful. |
@benjamn here is the smallest repro I managed to get. import { InMemoryCache, ApolloClient, gql } from '@apollo/client'
const cache = new InMemoryCache({
typePolicies: {
Query: {
fields: {
foo: () => 'foo'
}
}
}
})
cache.policies.addTypePolicies({
Query: {
// If you comment the fields property, the logs will return 'foo'
fields: {
settings: () => {}
}
}
})
const client = new ApolloClient({
cache
})
console.log(client.query({ query: gql` { foo } ` }))
// results of commented typePolicies fields property
// Promise {<pending>}
// __proto__: Promise
// [[PromiseState]]: "fulfilled"
// [[PromiseResult]]: Object
// data: {foo: "foo"}
// loading: false
// networkStatus: 7
// results of uncommented typePolicies fields property
// Promise {<pending>}
// __proto__: Promise
// [[PromiseState]]: "fulfilled"
// [[PromiseResult]]: undefined It seems like it's due to the use of This is new behavior starting 3.3.0, in 3.2.x it worked fine. |
I can confirm. We also use multiple |
@benjamn Any updates on this ? |
Intended outcome:
Trying to query a typePolicy field should work
Actual outcome:
The query is always loading
How to reproduce the issue:
Try to query a typePolicy field, e.g
Versions
apollo-client ^3.3.0 / ^3.3.6 / ^3.4 beta
The text was updated successfully, but these errors were encountered: