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

When notifyOnNetworkStatusChange is set to true and call refetch, then the network states sticks and always shows NetworkStatus.loading #1890

Open
dkhrunov opened this issue Jan 26, 2023 · 0 comments

Comments

@dkhrunov
Copy link

dkhrunov commented Jan 26, 2023

Describe the bug

When notifyOnNetworkStatusChange is set to true and call refetch, then the network states sticks and always shows loading spinner

To Reproduce
Steps to reproduce the behavior:

  1. Create queryRef:
this.queryRef = this.readQuery.watch(variables, {
      fetchPolicy: 'cache-and-network',
      // BUG if uncomment next line, then there will be an infinite load when calling refetch
      // notifyOnNetworkStatusChange: true,
      ...readQuery?.options
    })
  1. Call refetch
this.queryRef.refetch(variables);
  1. Observe loading status
this.querying$ = this.queryRef?.valueChanges.pipe(
      map((x) => x.loading),
      distinctUntilChanged(),
      shareReplay(1)
);

Expected behavior

Then refetch complete network request loading indicator should be false

Environment:

- @angular/cli@14.2.6
- @angular/core@14.2.7
- @apollo/client@3.7.0
- apollo-angular@4.1.0
- graphql@16.6.0
- typescript@4.8.4
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

No branches or pull requests

1 participant