Intended outcome:
I updated my dependencies moving from appolo-client 2.4.12 to 2.5.1 and react-apollo 2.4.1 to 2.5.2. One of my tests using MockedProvider failed since. I have several tests using this provider, the one that failed was the only one testing a query with fetchPolicy="no-cache"
Actual outcome:
The mocked data is no longer passed to the query.
How to reproduce the issue:
See this reproduction repo: https://github.com/htulipe/react-apollo-fetch-policy-bug
There are two tests, one passing (with default fetchPolicy) and one failing (with "no-cache") under appolo-client 2.5.1. If you downgrade to 2.4.12, both tests pass.
Version
Any news on this matter @hwillson ?
Having the same issue, mocked test works fine with default fetch policy but fails with fetchPolicy="no-cache"
It seems like the component renders the error no more mocks too fast.
For what it worth, to avoid being stuck on 2.4, I do this in my tests:
fetchPolicy={process.env.NODE_ENV === 'test' ? undefined : 'no-cache'}
It's clearly not ideal since I'm testing my code under another configuration than the one actually used.
this problem still persists
React Apollo has been refactored to use React Hooks behind the scenes for everything, which means a lot has changed since this issue was opened (and a lot of outstanding issues have been resolved). We'll close this issue off, but please let us know if you're still encountering this problem using React Apollo >= 3.1.0. Thanks!
This is still an issue running React Apollo 3.1.3
and apollo-client 2.6.4
Most helpful comment
This is still an issue running React Apollo 3.1.3
and apollo-client 2.6.4