Apollo-client: Polling (and force fetch in general) while the client is disconnected empties the store after erroring

Created on 29 Jun 2016  路  9Comments  路  Source: apollographql/apollo-client

Expected

If the polling fails because of a connection issue, still show errors in the console and everything, but don't change the contents of the store!

Obtained

If the polling fails because of a connection issue, errors arise in the console and empties the store where the query is.

Is this really the behavior we want ?

Fix proposition

Polling shouldn't just trigger a forceFetch but a forceFetch able to, when an error arises, don't change the apollo store state.

馃悶 bug

Most helpful comment

I need to retake a look. Maybe a recent change may have fixed that.

All 9 comments

Good point! Will look into this. Error handling in general is something we are taking a look at soon.

Yes, then, in this case, I would be for, by default, not delete the contents of the store. (I thought the behavior was wanted if graphql errors arised)

I can look into that if you want as well, I will need a fix pretty ASAP and I see you guys already have a bunch of projects going on! 馃槈

We were going to take a look at error handling late this week or early next week, but I'd be happy to look at a design for a fix, or a PR!

Let me just finish first with #335, I'll see after that!

I attempted to reproduce this issue within a unit test in #368 but wasn't able to do it. Maybe I'm misunderstanding the problem or the problem is somewhere else, but it seems that the store is not emptied if we have a polling query that faces a network/connection error of some kind.

Could you provide some insight as to what setup leads to this issue @rricard ?

I need to retake a look. Maybe a recent change may have fixed that.

@Poincare: my bad the issue is on apollostack/react-apollo: when an error is associated to the component, the component doesn't receive the data anymore.

Was this page helpful?
0 / 5 - 0 ratings