Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Refetch after error does not re-render the component #636

Closed
StevePotter opened this issue Apr 17, 2017 · 3 comments
Closed

Refetch after error does not re-render the component #636

StevePotter opened this issue Apr 17, 2017 · 3 comments

Comments

@StevePotter
Copy link
Contributor

Like many apps, I have a screen that fills its data from graphql. It has a pull to refresh list. When you pull to refresh, it does a graphql refetch() If:

  1. User views a list with pull to refresh (which calls refetch())

  2. User loses connectivity

  3. User pulls to refresh

  4. Error message is shown due to existence of graphql error

  5. User regains connectivity

  6. User pulls to refresh

  7. Error message still shows. error is still there in props!

This is because react-apollo never gets notified of the query change (happens here and thus it never re-renders.

I dug into it and the problem is actually from apollo-client, not react-apollo. They optimized to prevent duplicate subscription notifications but didn't take into account my scenario: apollographql/apollo-client#1601

I'd be happy to make a test to prove the behavior. Or please reach out to me and I can provide a sample application. I love that you are testing your libraries, but I've had a very hard time building a good offline experience with Apollo and React Native. Thanks!

@helfer
Copy link
Contributor

helfer commented Apr 21, 2017

Hi @StevePotter, thanks again for #1601! Can you install [email protected] and let me know if that fixes the issue for you (it's not yet tagged as latest).

@helfer helfer closed this as completed Apr 21, 2017
@ardavank
Copy link

@helfer I'm having the same issue using the following:
"apollo-cache-inmemory": "^1.1.4",
"apollo-client": "^2.0.4",
"apollo-client-preset": "^1.0.5",
"apollo-link-http": "^1.3.2",
"react-apollo": "^2.0.4",

When I call refetch, I noticed that it actually makes the call to the server and grabs the data, but never calls the render to update the data in the component.

@ardavank
Copy link

I created a new bug for it:

#1466

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants