From c823fedf26c16e23c451c0d90f860fcefa3b5a45 Mon Sep 17 00:00:00 2001 From: Shadaj Laddad Date: Mon, 10 Jul 2017 15:30:34 -0700 Subject: [PATCH] Add support for devtools with new query and mutations store location --- src/ApolloClient.ts | 10 ++++++++-- src/mutations/store.ts | 4 ++++ src/queries/store.ts | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ApolloClient.ts b/src/ApolloClient.ts index d0737c7d26d..30b6dfdf992 100644 --- a/src/ApolloClient.ts +++ b/src/ApolloClient.ts @@ -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(), }); } @@ -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(), }); } diff --git a/src/mutations/store.ts b/src/mutations/store.ts index f17eafaf8e2..5ee4f28e1a7 100644 --- a/src/mutations/store.ts +++ b/src/mutations/store.ts @@ -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]; } diff --git a/src/queries/store.ts b/src/queries/store.ts index 7c569e80911..03640d85e58 100644 --- a/src/queries/store.ts +++ b/src/queries/store.ts @@ -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]; }