From 7caeff87c43c0366f9471f1d2afa6d9402568e49 Mon Sep 17 00:00:00 2001 From: Bouba Date: Sat, 23 Sep 2017 14:07:00 +0200 Subject: [PATCH] Bind this to watchQuery to be sure that we don't lose it (#51) --- src/RxApolloClient.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/RxApolloClient.ts b/src/RxApolloClient.ts index 5d85833..6ff0469 100644 --- a/src/RxApolloClient.ts +++ b/src/RxApolloClient.ts @@ -1,7 +1,7 @@ -import { ApolloClient, WatchQueryOptions } from 'apollo-client'; +import {ApolloClient, WatchQueryOptions} from 'apollo-client'; -import { RxObservableQuery } from './RxObservableQuery'; -import { createWithObservableVariables } from './utils/variables'; +import {RxObservableQuery} from './RxObservableQuery'; +import {createWithObservableVariables} from './utils/variables'; export class RxApolloClient extends ApolloClient { constructor(options: any) { @@ -10,7 +10,7 @@ export class RxApolloClient extends ApolloClient { public watchQuery(options: WatchQueryOptions): any { // RxObservableQuery { if (typeof options.variables === 'object') { - return createWithObservableVariables(options, super.watchQuery); + return createWithObservableVariables(options, super.watchQuery.bind(this)); } return new RxObservableQuery(super.watchQuery(options));