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 broken getQueryWithPreviousResult return type declaration #3731

Merged
merged 2 commits into from
Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
**Note:** This is a cumulative changelog that outlines all of the Apollo Client project child package changes that were bundled into a specific `apollo-client` release.

## 2.3.7 (July 24, 2018)

### Apollo Client (2.3.7)

- Release 2.3.6 broke Typescript compilation. `QueryManager`'s
`getQueryWithPreviousResult` method included an invalid `variables` return
type in the auto-generated `core/QueryManager.d.ts` declaration file. The
type definition had a locally referenced path, that appears to have been
caused by the typescript compiler getting confused at compile/publish time.
`getQueryWithPreviousResult` return types are now excplicity identified,
which helps Typescript avoid the local type reference. For more details,
see https://github.com/apollographql/apollo-client/issues/3729.
[@hwillson](https://github.com/hwillson) in [#3731](https://github.com/apollographql/apollo-client/pull/3731)

### Apollo Boost (0.1.12)

- No changes.

### Apollo Cache (1.1.14)

- No changes.

### Apollo Cache In-Memory (1.2.7)

- No changes.

### Apollo Utilities (1.0.18)

- No changes.

### Apollo GraphQL Anywhere (4.1.16)

- No changes.


## 2.3.6 (July 24, 2018)

### Apollo Client (2.3.6)
Expand Down
13 changes: 11 additions & 2 deletions packages/apollo-client/src/core/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ import {
} from './watchQueryOptions';
import { ObservableQuery } from './ObservableQuery';
import { NetworkStatus, isNetworkRequestInFlight } from './networkStatus';
import { QueryListener, ApolloQueryResult, FetchType } from './types';
import {
QueryListener,
ApolloQueryResult,
FetchType,
OperationVariables,
} from './types';
import { graphQLResultHasError } from 'apollo-utilities';

export interface QueryInfo {
Expand Down Expand Up @@ -1005,7 +1010,11 @@ export class QueryManager<TStore> {

public getQueryWithPreviousResult<T>(
queryIdOrObservable: string | ObservableQuery<T>,
) {
): {
previousResult: any;
variables: OperationVariables | undefined;
document: DocumentNode;
} {
let observableQuery: ObservableQuery<T>;
if (typeof queryIdOrObservable === 'string') {
const { observableQuery: foundObserveableQuery } = this.getQuery(
Expand Down