From 69b52806bdff4623d877ec5903ea4f398255f7b0 Mon Sep 17 00:00:00 2001 From: Spencer Miskoviak Date: Sun, 12 Aug 2018 20:44:00 -0700 Subject: [PATCH 1/3] Replace duplicate types with types defined in apollo-client --- src/Query.tsx | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/Query.tsx b/src/Query.tsx index b52f19ae4a..8b052d6a25 100644 --- a/src/Query.tsx +++ b/src/Query.tsx @@ -7,6 +7,8 @@ import ApolloClient, { ErrorPolicy, ApolloQueryResult, NetworkStatus, + FetchMoreOptions, + FetchMoreQueryOptions, } from 'apollo-client'; import { DocumentNode } from 'graphql'; import { ZenObservable } from 'zen-observable-ts'; @@ -16,30 +18,12 @@ import { parser, DocumentType, IDocumentDefinition } from './parser'; const shallowEqual = require('fbjs/lib/shallowEqual'); const invariant = require('invariant'); -// Improved FetchMoreOptions type, need to port them back to Apollo Client -export interface FetchMoreOptions { - updateQuery: ( - previousQueryResult: TData, - options: { - fetchMoreResult?: TData; - variables: TVariables; - }, - ) => TData; -} - -// Improved FetchMoreQueryOptions type, need to port them back to Apollo Client -export interface FetchMoreQueryOptions { - variables: Pick; -} - // XXX open types improvement PR to AC // Improved ObservableQuery field types, need to port them back to Apollo Client export type ObservableQueryFields = Pick< ObservableQuery, - 'startPolling' | 'stopPolling' | 'subscribeToMore' + 'startPolling' | 'stopPolling' | 'subscribeToMore' | 'updateQuery' | 'refetch' | 'variables' > & { - variables: TVariables; - refetch: (variables?: TVariables) => Promise>; fetchMore: (( fetchMoreOptions: FetchMoreQueryOptions & FetchMoreOptions, ) => Promise>) & @@ -47,9 +31,6 @@ export type ObservableQueryFields = Pick< fetchMoreOptions: { query: DocumentNode } & FetchMoreQueryOptions & FetchMoreOptions, ) => Promise>); - updateQuery: ( - mapFn: (previousQueryResult: TData, options: { variables?: TVariables }) => TData, - ) => void; }; function compact(obj: any) { From 269cb35a02791272940ecdd374c5789ed3a22715 Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Wed, 22 Aug 2018 10:34:16 -0400 Subject: [PATCH 2/3] Remove no longer needed comment --- src/Query.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Query.tsx b/src/Query.tsx index 387f20b237..d5b0a50e2b 100644 --- a/src/Query.tsx +++ b/src/Query.tsx @@ -18,8 +18,6 @@ import { parser, DocumentType, IDocumentDefinition } from './parser'; const shallowEqual = require('fbjs/lib/shallowEqual'); const invariant = require('invariant'); -// XXX open types improvement PR to AC -// Improved ObservableQuery field types, need to port them back to Apollo Client export type ObservableQueryFields = Pick< ObservableQuery, 'startPolling' | 'stopPolling' | 'subscribeToMore' | 'updateQuery' | 'refetch' | 'variables' From 655780b50307a95b590dc505dcf19e28dd111cb4 Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Wed, 22 Aug 2018 10:37:31 -0400 Subject: [PATCH 3/3] Changelog update --- Changelog.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index e6449ae7dd..52a246a3c8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -25,10 +25,13 @@ check for errors is to use the result `errors` property.
[@TLadd](https://github.com/TLadd) in [#1983](https://github.com/apollographql/react-apollo/pull/1983) - Allow a custom `cache` object to be passed into the test-utils - `MockedProvider`.
+ `MockedProvider`.
[@palmfjord](https://github.com/palmfjord) in [#2254](https://github.com/apollographql/react-apollo/pull/2254) -- Make the `MockedProvider` `mocks` prop read only.
+- Make the `MockedProvider` `mocks` prop read only.
[@amacleay](https://github.com/amacleay) in [#2284](https://github.com/apollographql/react-apollo/pull/2284) +- Remove duplicate `FetchMoreOptions` and `FetchMoreQueryOptions` types, and + instead import them from Apollo Client.
+ [@skovy](https://github.com/skovy) in [#2281](https://github.com/apollographql/react-apollo/pull/2281) ## 2.1.11 (August 9, 2018)