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.38k stars 2.66k forks source link

startTransition has no affect on refetch or fetchMore with errorPolicy: 'all' #11708

Closed berzhavycha closed 8 months ago

berzhavycha commented 8 months ago

Issue Description

When using startTransition with refetch, I expect "Loading..." not to appear when I click on fetchMore. I cannot change errorPolicy to another value as this is necessary for my project. You can change errorPolicy to another value, and everything will work correctly, but this is not what i want

Link to Reproduction

https://stackblitz.com/edit/stackblitz-starters-esklwr?file=src%2Fcomponents%2FApolloProvider.tsx

Reproduction Steps

No response

@apollo/client version

3.8.9

jerelmiller commented 8 months ago

Hey @berzhavycha 👋

Thanks for the report and the reproduction! This is such a weird one. It doesn't look so much like it has to do with the value of the errorPolicy but rather where its set. I see the reproduction sets errorPolicy with defaultOptions. If I comment this out and instead move that error policy to the hook itself, the hook behaves as expected. See my fork of the reproduction to see this working as expected.

I'll dig into this a bit more soon, but looks like for now the workaround would be to set errorPolicy on the hook itself.

jerelmiller commented 8 months ago

Thankfully I was able to figure this one out pretty quick 🙂. This one is fixed with #11713. I've tried this fix out with a fork of the reproduction and this is working as expected. Expect this to ship with the next patch version 🙂

github-actions[bot] commented 8 months ago

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. For general questions, we recommend using StackOverflow or our discord server.