Apollo-client: Refetch triggers twice

Created on 25 Sep 2018  路  6Comments  路  Source: apollographql/apollo-client

Intended outcome:
refetch should always work correctly

Actual outcome:
refetch sometimes triggers twice, one with the new variables (which is correct) and after that with the initial variables

How to reproduce the issue:
i can not reproduce constantly, sometimes works ok, sometimes does not, i tried many things from using the old HOCs graphql to new react render-prop components, changing fetchPolicy and more

Versions
latest

Most helpful comment

The issue was too serious for our company's product, imagine our users sometimes couldnt use filter, search and load more... so we dropped apollo client and created our own version. Good luck!

All 6 comments

that happens on fetchMore too

I'm trying to make a reproduction case for this error. For me this is happening because ObservableQuery.prototype.refetch is invoked once with the new variables, and then Query.prototype.componentWillReceiveProps calls ObservableQuery.prototype.updateQuery with the old variables. Since the Query component is involved, I believe this is related to react-apollo.

Reproduction: https://codesandbox.io/s/j3410pq2vv

This is probably a duplicate of #2285

The issue was too serious for our company's product, imagine our users sometimes couldnt use filter, search and load more... so we dropped apollo client and created our own version. Good luck!

Closing as duplicate of #2285

This is still an issue, but the "OP" was just closed #2285

Was this page helpful?
0 / 5 - 0 ratings