Skip to content

Commit

Permalink
Bind this to watchQuery to be sure that we don't lose it (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouba authored and kamilkisiela committed Sep 23, 2017
1 parent 655470b commit 7caeff8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions 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) {
Expand All @@ -10,7 +10,7 @@ export class RxApolloClient extends ApolloClient {

public watchQuery(options: WatchQueryOptions): any { // RxObservableQuery<ApolloQueryResult> {
if (typeof options.variables === 'object') {
return createWithObservableVariables(options, super.watchQuery);
return createWithObservableVariables(options, super.watchQuery.bind(this));
}

return new RxObservableQuery(super.watchQuery(options));
Expand Down

0 comments on commit 7caeff8

Please sign in to comment.