Open
Description
Hi, I chose to use apollo-client
for my Nodejs build scripts, basically retrieving the latest release from a Github repository and pushing new releases.
I like the architecture of the module where different concerns are separated and pluggable (network protocol, caching implementation, etc.), but I find it strange that caching is mandatory, while at the same time the policy option for no-cache
is available. What about treating undefined apollo-client
cache
option as if no-cache
policy is on ?
Current implementation:
import { ApolloClient } from 'apollo-client'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { HttpLink } from 'apollo-link-http'
const defaultOptions = {
watchQuery: {
fetchPolicy: 'no-cache', // 🙀
errorPolicy: 'ignore',
},
query: {
fetchPolicy: 'no-cache', // 🙀
errorPolicy: 'all',
},
mutate: {
errorPolicy: 'all'
}
}
const client = new ApolloClient({
link: new HttpLink(),
cache: new InMemoryCache(), // 🙀
defaultOptions
})
Suggested implementation:
import { ApolloClient } from 'apollo-client'
import { HttpLink } from 'apollo-link-http'
const client = new ApolloClient({
link: new HttpLink(),
cache: null // 👌will result in `no-cache` default options for both `query` and `watchQuery`.
})
Versions:
"apollo-cache-inmemory": "^1.4.2",
"apollo-client": "^2.4.12",
"apollo-link-http": "^1.5.11"