Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make calls of the refetch() & fetchMore() trigger loading state #1366

Merged

Conversation

nevermin9
Copy link
Contributor

@nevermin9 nevermin9 commented Jun 4, 2022

Description

This PR makes call of the refetch() or fetchMore() trigger loading.value to change.

Motivation

First, this issue.
Second, in the previous version of vue-apollo, $apollo.queries["query-name"].loading was changed every time when we call fetchMore()/refetch() or just changed values of the variables. And such behavior was very handy, reliable and expectable.
Now, call of the refetch() sets true into loading.value, but doesn't set false when refetching is complete. fatchMore() doesn't change value of loading.value at all.
Enabling notifyOnNetworkStatusChange option is not a good idea, bc on the same page we can have several components and if both of them enable such notifyOnNetworkStatusChange, both will show their loading states while only one component was calling refetch()/fetchMore() etc.
Loading state in one component has to stay independent from loading states of other components.

Testing notes

All tests are passed.
I checked @vue/apollo-composable with this fix in my project and everything works as expected.

@nevermin9 nevermin9 changed the title feat!: Make calls of the *refetch()* & *fetchMore()* trigger *loading* state feat!: Make calls of the refetch() & fetchMore() trigger loading state Jun 5, 2022
@Akryum Akryum changed the title feat!: Make calls of the refetch() & fetchMore() trigger loading state fix: Make calls of the refetch() & fetchMore() trigger loading state Jun 23, 2022
@Akryum Akryum merged commit a32fe9c into vuejs:v4 Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants