the-guild-org / the-guild-org/apollo-angular
When `notifyOnNetworkStatusChange` is set to true and call refetch, then the network states sticks and always shows NetworkStatus.loading
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 309
- Avg merge
- 1h 45m
- Merged PRs (30d)
- 3
Description
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:
- 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
})
- Call refetch
this.queryRef.refetch(variables);
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the shown watch configuration, fetchPolicy, notifyOnNetworkStatusChange, refetch, and valueChanges pipeline. Trace the network status emitted after refetch completes; done means the loading value becomes false instead of remaining true indefinitely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, graphql, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100