Skip to content

Commit

Permalink
Adds interface to allow for specification of IDs on Apollo Client (#2274
Browse files Browse the repository at this point in the history
)

* Adds interface to allow for specification of IDs on Apollo Client

The issue came about when trying to specify IDs in Apollo configuration to tell queries about updates when new information becomes available for an Angular project, as per http://dev.apollodata.com/angular2/cache-updates.html

This solution was proposed by @Nyaruiru:
#2201 (comment)

* change id type to string instead of number

* Add Changelog

* fixes changelog
  • Loading branch information
maplion authored and James Baxley committed Oct 10, 2017
1 parent 38fcefa commit dd8510a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change log

### vNEXT
- Fix the ability to specify IDs in Apollo configuration to tell queries about updates when new information becomes available [PR #2274](https://github.com/apollographql/apollo-client/pull/2274)
- Fix response not being included with errors that have response body [PR #2239](https://github.com/apollographql/apollo-client/pull/2239)

- Allow conditional refetchQueries [PR #2234](https://github.com/apollographql/apollo-client/pull/2234)
Expand Down
8 changes: 7 additions & 1 deletion src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ export enum FetchType {
poll = 3,
}

export type IdGetter = (value: Object) => string | null | undefined;
export interface IdGetterObj extends Object {
__typename?: string;
id?: string;
}
export declare type IdGetter = (
value: IdGetterObj,
) => string | null | undefined;

0 comments on commit dd8510a

Please sign in to comment.