Skip to content

Commit

Permalink
Avoid refetching observerless ObservableQuerys during `refetchQueri…
Browse files Browse the repository at this point in the history
…es` (#7877)
  • Loading branch information
dannycochran authored Mar 24, 2021
1 parent 6a6a7fc commit da0a0e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
- Remove unnecessary TypeScript global `Observable<T>["@@observable"]` method declaration. <br/>
[@benjamn](https://github.com/benjamn) in [#7888](https://github.com/apollographql/apollo-client/pull/7888)

- Prevent skipped/observerless `ObservableQuery`s from being refetched by `refetchQueries`. <br/>
[@dannycochran](https://github.com/dannycochran) in [#7877](https://github.com/apollographql/apollo-client/pull/7877)

## Apollo Client 3.3.12

### Bug fixes
Expand Down
1 change: 1 addition & 0 deletions src/core/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export class QueryManager<TStore> {
if (typeof refetchQuery === 'string') {
self.queries.forEach(({ observableQuery }) => {
if (observableQuery &&
observableQuery.hasObservers() &&
observableQuery.queryName === refetchQuery) {
refetchQueryPromises.push(observableQuery.refetch());
}
Expand Down

0 comments on commit da0a0e5

Please sign in to comment.