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

Loading not set to true while setting new variables after an error #1817

Closed
dallonf opened this issue Mar 21, 2018 · 3 comments
Closed

Loading not set to true while setting new variables after an error #1817

dallonf opened this issue Mar 21, 2018 · 3 comments
Labels
has-reproduction ❤ Has a reproduction in a codesandbox or single minimal repository

Comments

@dallonf
Copy link

dallonf commented Mar 21, 2018

Intended outcome:

Refetch a query with new variables after receiving an error from the server. I would expect loading to be true while this is happening.

Example: https://codesandbox.io/s/n73jj3x70

Actual outcome:

Although networkStatus is 2 (setVariables), loading is false. This contradicts the documentation for networkStatus:

If the network status is less then 7 then it is equivalent to data.loading being true. In fact you could replace all of your data.loading checks with data.networkStatus < 7 and you would not see a difference. It is recommended that you use data.loading, however.

How to reproduce the issue:

Example: https://codesandbox.io/s/n73jj3x70

Write in the text box to update the query variables. A name that starts with "bob" will cause an error.

  1. Write a valid name: "Susan"
  2. Write a name with an error: "Bob"
  3. Write another valid name: "Fred"

Notice that during Step 3, the "Loading..." state does not appear despite the network status being 2.

Note react-apollo is at 2.1.0-rc.5; on the latest version (2.0.4), you will instead observe #1336, and the state will switch to loading: true but never actually make a request.

Version

@ghost ghost added the has-reproduction ❤ Has a reproduction in a codesandbox or single minimal repository label Mar 21, 2018
@nlucero
Copy link

nlucero commented Apr 19, 2018

Can reproduce with version 2.1.3

@Gasperan
Copy link

any update for this? :(

@jasonpaulos
Copy link
Contributor

I am unable to reproduce this issue, so it looks like it may have been fixed in a recent update. Feel free to re-open if the problem continues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has-reproduction ❤ Has a reproduction in a codesandbox or single minimal repository
Projects
None yet
Development

No branches or pull requests

4 participants