Apollo Angular 4.0 `QueryRef.fetchMore` parameter typings remove `updateQuery` property
See original GitHub issueDescribe the bug
Upgrading from apollo-angular@3.0.1
to apollo-angular@4.0.1
produces TS2345 error on code which passes an updateQuery
property to the fetchMoreOptions
parameter of a QueryRef.fetchMore
call.
To Reproduce
Previously, the QueryRef.fetchMore
fetchMoreOptions
parameter was typed with FetchMoreQueryOptions
& FetchMoreOptions
but Apollo Angular 4 removed FetchMoreOptions
and with it the updateQuery
property on the parameter.
Expected behavior
The method signature should not change, since the underlying Apollo Client ObservableQuery.fetchMore
method still has updateQuery
in its signature.
Environment:
├── @angular/cli@14.1.3
├── @angular/core@14.1.3
├── @apollo/client@3.6.8
├── apollo-angular@4.0.1
├── barrel-maintainer@1.5.3
├── graphql@16.5.0
└── typescript@4.7.4
Additional context That pretty much sums it up.
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[typescript] the "query" parameter in fetchMore should not be ...
When using Query with fetchMore for pagination, typescript complains that the argument with just variables and updateQuery is not assignable ...
Read more >TypeScript with Apollo Client - Apollo GraphQL Docs
By default, the type parameters for fetchMore are the same as those for useQuery . Because both fetchMore and useQuery encapsulate a query...
Read more >Pagination – Angular - GraphQL Code Generator
Apollo lets you do pagination with a method called fetchMore . You need to specify what query and variables to use for the...
Read more >Running Apollo Angular watchQuery() with different variables ...
I just solved a similar issue you were having and the trick was to call this._querySubscription.refetch(newVariables) .
Read more >Getting started with Apollo + GraphQL in Angular - Briebug Blog
Apollo is an open source GraphQL client built for Javascript and includes comprehensive integrations with Angular, React and Vue.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, @alfaproject — Well, so far as I can see,
updateQuery
is still available onObservableQuery
in Apollo Client 3.x and not marked in the code as deprecated, so I think you could continue using it with Apollo Angular 4 with suitable@ts-ignore
comments, but since I haven’t seen anything to contradict the statements from the Apollo team that I linked to in my last message indicating thatupdateQuery
will be removed in Apollo Client 4 and thefetchMore
documentation has been updated to remove reference toupdateQuery
in favor of field policies, I do think that you’ll eventually have to update your code to use merge functions on field policies, one for each field that needs your dynamicupdateQuery
logic. Note that field policy merge functions can be generic with respect to the data type, just as yourupdateQuery
function example is.@KeithGillette I have a dynamic helper that creates a dynamic
updateQuery
to avoid repetition, something like this:Are you telling me that we now need to go to our cache adaptor and add type policy for each individual connection. We have hundreds of them and each one is ‘owned’ by a particular service which is agnostic to the cache o.o