Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
Export Context type from types.ts instead of walkTree.ts. (#2832)
Browse files Browse the repository at this point in the history
When we stopped reexporting everything from walkTree.ts as part of #2533,
we also stopped exporting the Context type that it uses.

Moving the declaration and export of Context from walkTree.ts to types.ts
restores the ability to do

  import { Context } from "react-apollo"

which should fix #2824.
  • Loading branch information
benjamn authored Mar 1, 2019
1 parent 626da64 commit ce333cd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
10 changes: 9 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Change log

## vNEXT

### Bug Fixes

- Export `Context` type from `types.ts` instead of `walkTree.ts`,
to reenable `import { Context } from 'react-apollo'` (which has been
broken since 2.4.0). <br/>
[@benjamn](https://github.com/benjamn) in [#2825](https://github.com/apollographql/react-apollo/pull/2832)

## 2.5.1

### Bug Fixes
Expand All @@ -9,7 +18,6 @@
the created test `ApolloClient` instance. <br/>
[@hwillson](https://github.com/hwillson) in [#2825](https://github.com/apollographql/react-apollo/pull/2825)


## 2.5.0

### Improvements
Expand Down
8 changes: 6 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import ApolloClient, {
} from 'apollo-client';
import { MutationFn } from './Mutation';

export interface Context {
[key: string]: any;
};

export type OperationVariables = {
[key: string]: any;
};
Expand All @@ -31,7 +35,7 @@ export interface MutationOpts<TData = any, TGraphQLVariables = OperationVariable
update?: MutationUpdaterFn<TData>;
client?: ApolloClient<any>;
notifyOnNetworkStatusChange?: boolean;
context?: Record<string, any>;
context?: Context;
onCompleted?: (data: TData) => void;
onError?: (error: ApolloError) => void;
fetchPolicy?: FetchPolicy;
Expand All @@ -45,7 +49,7 @@ export interface QueryOpts<TGraphQLVariables = OperationVariables> {
pollInterval?: number;
client?: ApolloClient<any>;
notifyOnNetworkStatusChange?: boolean;
context?: Record<string, any>;
context?: Context;
partialRefetch?: boolean;
}

Expand Down
5 changes: 1 addition & 4 deletions src/walkTree.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import * as React from 'react';

export interface Context {
[key: string]: any;
}
import { Context } from './types';

interface PreactElement<P> {
attributes: P;
Expand Down

0 comments on commit ce333cd

Please sign in to comment.