apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.35k stars 2.66k forks source link

Loading is false while fetching data #11318

Open gurschitz opened 11 months ago

gurschitz commented 11 months ago

Issue Description

Hi there!

We are currently on Apollo 3.7.17 and looking into upgrading to latest Apollo (3.8.6 as time of writing). In 3.7.17 we are still experiencing https://github.com/apollographql/apollo-client/issues/10737, where we have the same setup with cache-and-network being the default fetchPolicy. In our case it also happens that we run a query with cache-and-network, then due to the nextFetchPolicy function that we implement, we set the next fetch policy to cache-first (similar to how it is mentioned in the docs). Now while the first query is still running and the cached result is returned, we get back the loading state being false.

This caused us to implement some workarounds, that we also need to think of whenever we add new queries. In the linked issue, there is a comment saying that this issue got inadvertently fixed in 3.8.x.

However, I have found that since 3.8.5, it happens again. Using the original code sandbox from the issue, I can see that it works with 3.8.4 but doesn't work with 3.8.5.

Link to Reproduction

https://codesandbox.io/s/loading-false-while-fetching-forked-45yqz8?file=/src/index.jsx

Reproduction Steps

See the reproduction link above.

bignimbus commented 11 months ago

Hi @gurschitz 👋🏻 thanks for opening this issue! The team needs to triage this one further but we'll be taking a look soon. Thanks so much for the reproduction case 🙏🏻

malininss commented 2 months ago

This problem is still actual. Any updates?

norzserge commented 2 months ago

Same. Problem is still actual.

dmitrysurdin commented 2 months ago

The issue is reproducible