react-apollo icon indicating copy to clipboard operation
react-apollo copied to clipboard

Setting ssrForceFetchDelay cause polling queries to fail

Open jackyef opened this issue 6 years ago • 1 comments

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:

  1. Create a polling query with cache-and-network fetchPolicy.
  2. Set ssrForceFetchDelay to 100

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.

jackyef avatar Nov 12 '19 10:11 jackyef

Same problem here.

horaciosystem avatar May 23 '20 23:05 horaciosystem