Vue-apollo: Loading is false using 'no-cache'

Created on 5 Feb 2019  路  9Comments  路  Source: vuejs/vue-apollo

Why when I reload the page loading is false?
When I use fetchMore, loading changes to true, but on the first load, loading is false
I'm using 'no-cache' option

defaultOptions: {
    $query: {
      fetchPolicy: 'no-cache',
    },
  },
upstream

Most helpful comment

I have the same issue...

All 9 comments

I have the same issue...

It seems to be an issue with Apollo Client.

@Akryum Is this not an issue caused by the referenced commit (82d6c02f7b0202d7682007449dfce56de0f5f243)?

Hey @Akryum, what is the news with this issue? what do you suggest for those who use the no-cache option

I reproduced the issue with the vue-apollo e2e test. If you add the :fetch-policy="'no-cache'" to the ApolloQuery here

After this change, running the npm run test:e2e:dev:client will show this error:
Screenshot 2020-04-24 at 10 12 25

So this check mentionned here by michael-harrison on "no-cache" was added here: https://github.com/vuejs/vue-apollo/pull/280 and discussed here https://github.com/vuejs/vue-apollo/commit/82d6c02f7b0202d7682007449dfce56de0f5f243 . I'm still not sure it this is the cause of the issue, but disabling the loading state to prevent an issue with optimistic response of no-cache queries seems strange.

Edit: commenting the mentionned condition is enough to fix the isLoading in the ApolloQuery component but the result.loading is still always false.

Starting to wonder if this is an issue with apollo client.

The shouldNotifyIfLoading condition here don't seem to set the loading property if the fetch policy is no-cache or network-only.

Setting notifyOnNetworkStatusChange does indeed seems to "fix" the issue.

Reading a bit more it seems that the loading state is a recurring issue with apollo-client (https://github.com/apollographql/react-apollo/issues/727#issuecomment-306082518 and https://github.com/apollographql/react-apollo/issues/2238 for example), which all suggest setting the notifyOnNetworkStatusChange to fix this.

Any update?

any luck?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jakub300 picture jakub300  路  4Comments

jsrkstr picture jsrkstr  路  3Comments

beeplin picture beeplin  路  4Comments

agosto-chrisbartling picture agosto-chrisbartling  路  4Comments

AruXc picture AruXc  路  4Comments