Skip to content

Commit

Permalink
Add support for devtools with new query and mutations store location
Browse files Browse the repository at this point in the history
  • Loading branch information
shadaj committed Jul 10, 2017
1 parent 0cfc9a1 commit c823fed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ApolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,10 @@ export default class ApolloClient implements DataProxy {
if (this.devToolsHookCb) {
this.devToolsHookCb({
action,
state: this.queryManager.getApolloState(),
state: {
queries: this.queryManager.queryStore.__getStore(),
mutations: this.queryManager.mutationStore.__getStore(),
},
dataWithOptimisticResults: this.queryManager.getDataWithOptimisticResults(),
});
}
Expand Down Expand Up @@ -484,7 +487,10 @@ export default class ApolloClient implements DataProxy {
if (this.devToolsHookCb) {
this.devToolsHookCb({
action,
state: this.queryManager.getApolloState(),
state: {
queries: this.queryManager.queryStore.__getStore(),
mutations: this.queryManager.mutationStore.__getStore(),
},
dataWithOptimisticResults: this.queryManager.getDataWithOptimisticResults(),
});
}
Expand Down
4 changes: 4 additions & 0 deletions src/mutations/store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export class MutationStore {
private store: {[mutationId: string]: MutationStoreValue} = {};

public __getStore(): {[mutationId: string]: MutationStoreValue} {
return this.store;
}

public get(mutationId: string): MutationStoreValue {
return this.store[mutationId];
}
Expand Down
4 changes: 4 additions & 0 deletions src/queries/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import { NetworkStatus } from './networkStatus';
export class QueryStore {
private store: {[queryId: string]: QueryStoreValue} = {};

public __getStore(): {[queryId: string]: QueryStoreValue} {
return this.store;
}

public get(queryId: string): QueryStoreValue {
return this.store[queryId];
}
Expand Down

0 comments on commit c823fed

Please sign in to comment.