Setting ssrForceFetchDelay cause polling queries to fail
Intended outcome:
I have a query that is polling. The fetchPolicy is cache-and-network.
To prevent the query from fetching again when hydrating on the client side, I set ssrForceFetchDelay to 100 when creating an ApolloClient instance.
Actual outcome: An error occured!
Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries
I am guessing this happen because the way ssrForceFetchDelay works, it's setting the fetchPolicy to cache-first no matter what.
https://github.com/apollographql/apollo-client/blob/7eaf4132cd2cd6244260777799406aaa03fcf377/packages/apollo-client/src/ApolloClient.ts#L287
How to reproduce the issue:
- Create a polling query with
cache-and-networkfetchPolicy. - Set
ssrForceFetchDelayto100
Version
apollo-client: 2.6.4
@apollo/*: 3.1.3
I am not sure whether this should be fixed in apollo-client side, or react-apollo at the moment.
Same problem here.