From 51436784a38debc4842ef278d5b0539f52fec43d Mon Sep 17 00:00:00 2001 From: Paul Shen Date: Fri, 9 Dec 2016 13:07:52 -0800 Subject: [PATCH] Fix resetStore running stopped queries Taken from https://github.com/apollostack/apollo-client/pull/960 --- src/core/QueryManager.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/QueryManager.ts b/src/core/QueryManager.ts index ca9f86ca72f..29b24aa8bef 100644 --- a/src/core/QueryManager.ts +++ b/src/core/QueryManager.ts @@ -647,7 +647,11 @@ export class QueryManager { // the promise for it will be rejected and its results will not be written to the // store. Object.keys(this.observableQueries).forEach((queryId) => { - if (! this.observableQueries[queryId].observableQuery.options.noFetch) { + const storeQuery = this.reduxRootSelector(this.store.getState()).queries[queryId]; + + if (! this.observableQueries[queryId].observableQuery.options.noFetch && + ! (storeQuery && storeQuery.stopped) + ) { this.observableQueries[queryId].observableQuery.refetch(); } });